KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > client > net > NetDatabaseMetaData


1 /*
2
3    Derby - Class org.apache.derby.client.net.NetDatabaseMetaData
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20 */

21 package org.apache.derby.client.net;
22
23 import org.apache.derby.client.am.Configuration;
24 import org.apache.derby.client.am.ProductLevel;
25 import org.apache.derby.client.am.SqlException;
26 import org.apache.derby.shared.common.reference.JDBC30Translation;
27
28
29 public class NetDatabaseMetaData extends org.apache.derby.client.am.DatabaseMetaData {
30
31     private final NetAgent netAgent_;
32
33     /** True if the server supports QRYCLSIMP. */
34     private boolean supportsQryclsimp_;
35
36     public NetDatabaseMetaData(NetAgent netAgent, NetConnection netConnection) {
37         // Consider setting product level during parse
38
super(netAgent, netConnection, new ProductLevel(netConnection.productID_,
39                 netConnection.targetSrvclsnm_,
40                 netConnection.targetSrvrlslv_));
41         // Set up cheat-links
42
netAgent_ = netAgent;
43     }
44
45     //---------------------------call-down methods--------------------------------
46

47     public String JavaDoc getURL_() throws SqlException {
48         String JavaDoc urlProtocol;
49
50         urlProtocol = Configuration.jdbcDerbyNETProtocol;
51
52         return
53                 urlProtocol +
54                 connection_.serverNameIP_ +
55                 ":" +
56                 connection_.portNumber_ +
57                 "/" +
58                 connection_.databaseName_;
59     }
60
61     //-----------------------------helper methods---------------------------------
62

63     // Set flags describing the level of support for this connection.
64
// Flags will be set based on manager level and/or specific product identifiers.
65
// Support for a specific server version can be set as follows. For example
66
// if (productLevel_.greaterThanOrEqualTo(11,1,0))
67
// supportsTheBestThingEver = true
68
//
69
// WARNING WARNING WARNING !!!!
70
//
71
// If you define an instance variable of NetDatabaseMetaData that
72
// you want computeFeatureSet_() to compute, DO NOT assign an
73
// initial value to the variable in the
74
// declaration. NetDatabaseMetaData's constructor will invoke
75
// DatabaseMetaData's constructor, which then invokes
76
// computeFeatureSet_(). Initialization of instance variables in
77
// NetDatabaseMetaData will happen *after* the invocation of
78
// computeFeatureSet_() and will therefore overwrite the computed
79
// values. So, LEAVE INSTANCE VARIABLES UNINITIALIZED!
80
//
81
// END OF WARNING
82
protected void computeFeatureSet_() {
83
84         // Support for QRYCLSIMP was added in 10.2.0
85
if (productLevel_.greaterThanOrEqualTo(10, 2, 0)) {
86             supportsQryclsimp_ = true;
87         } else {
88             supportsQryclsimp_ = false;
89         }
90     }
91
92     /**
93      * Check whether the server has full support for the QRYCLSIMP
94      * parameter in OPNQRY.
95      *
96      * @return true if QRYCLSIMP is fully supported
97      */

98     final boolean serverSupportsQryclsimp() {
99         return supportsQryclsimp_;
100     }
101
102 }
103
Popular Tags