1 | /* |
2 | |
3 | Derby - Class org.apache.derby.client.net.NetDatabaseMetaData |
4 | |
5 | Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable. |
6 | |
7 | Licensed under the Apache License, Version 2.0 (the "License"); |
8 | you may not use this file except in compliance with the License. |
9 | You may obtain a copy of the License at |
10 | |
11 | http://www.apache.org/licenses/LICENSE-2.0 |
12 | |
13 | Unless required by applicable law or agreed to in writing, software |
14 | distributed under the License is distributed on an "AS IS" BASIS, |
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | See the License for the specific language governing permissions and |
17 | limitations under the License. |
18 | |
19 | */ |
20 | package org.apache.derby.client.net; |
21 | |
22 | import org.apache.derby.client.am.Configuration; |
23 | import org.apache.derby.client.am.ProductLevel; |
24 | import org.apache.derby.client.am.SqlException; |
25 | import org.apache.derby.shared.common.reference.JDBC30Translation; |
26 | |
27 | |
28 | public class NetDatabaseMetaData extends org.apache.derby.client.am.DatabaseMetaData { |
29 | |
30 | private final NetAgent netAgent_; |
31 | |
32 | /** True if the server supports QRYCLSIMP. */ |
33 | private boolean supportsQryclsimp_; |
34 | |
35 | public NetDatabaseMetaData(NetAgent netAgent, NetConnection netConnection) { |
36 | // Consider setting product level during parse |
37 | super(netAgent, netConnection, new ProductLevel(netConnection.productID_, |
38 | netConnection.targetSrvclsnm_, |
39 | netConnection.targetSrvrlslv_)); |
40 | // Set up cheat-links |
41 | netAgent_ = netAgent; |
42 | } |
43 | |
44 | //---------------------------call-down methods-------------------------------- |
45 | |
46 | public String getURL_() throws SqlException { |
47 | String urlProtocol; |
48 | |
49 | urlProtocol = Configuration.jdbcDerbyNETProtocol; |
50 | |
51 | return |
52 | urlProtocol + |
53 | connection_.serverNameIP_ + |
54 | ":" + |
55 | connection_.portNumber_ + |
56 | "/" + |
57 | connection_.databaseName_; |
58 | } |
59 | |
60 | //-----------------------------helper methods--------------------------------- |
61 | |
62 | // Set flags describing the level of support for this connection. |
63 | // Flags will be set based on manager level and/or specific product identifiers. |
64 | // Support for a specific server version can be set as follows. For example |
65 | // if (productLevel_.greaterThanOrEqualTo(11,1,0)) |
66 | // supportsTheBestThingEver = true |
67 | // |
68 | // WARNING WARNING WARNING !!!! |
69 | // |
70 | // If you define an instance variable of NetDatabaseMetaData that |
71 | // you want computeFeatureSet_() to compute, DO NOT assign an |
72 | // initial value to the variable in the |
73 | // declaration. NetDatabaseMetaData's constructor will invoke |
74 | // DatabaseMetaData's constructor, which then invokes |
75 | // computeFeatureSet_(). Initialization of instance variables in |
76 | // NetDatabaseMetaData will happen *after* the invocation of |
77 | // computeFeatureSet_() and will therefore overwrite the computed |
78 | // values. So, LEAVE INSTANCE VARIABLES UNINITIALIZED! |
79 | // |
80 | // END OF WARNING |
81 | protected void computeFeatureSet_() { |
82 | |
83 | // Support for QRYCLSIMP was added in 10.2.0 |
84 | if (productLevel_.greaterThanOrEqualTo(10, 2, 0)) { |
85 | supportsQryclsimp_ = true; |
86 | } else { |
87 | supportsQryclsimp_ = false; |
88 | } |
89 | } |
90 | |
91 | /** |
92 | * Check whether the server has full support for the QRYCLSIMP |
93 | * parameter in OPNQRY. |
94 | * |
95 | * @return true if QRYCLSIMP is fully supported |
96 | */ |
97 | final boolean serverSupportsQryclsimp() { |
98 | return supportsQryclsimp_; |
99 | } |
100 | |
101 | } |