001: /*
002:
003: Derby - Class org.apache.derby.client.net.NetDatabaseMetaData
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021: package org.apache.derby.client.net;
022:
023: import org.apache.derby.client.am.Configuration;
024: import org.apache.derby.client.am.ProductLevel;
025: import org.apache.derby.client.am.SqlException;
026: import org.apache.derby.shared.common.reference.JDBC30Translation;
027:
028: public class NetDatabaseMetaData extends
029: org.apache.derby.client.am.DatabaseMetaData {
030:
031: private final NetAgent netAgent_;
032:
033: /** True if the server supports QRYCLSIMP. */
034: private boolean supportsQryclsimp_;
035:
036: public NetDatabaseMetaData(NetAgent netAgent,
037: NetConnection netConnection) {
038: // Consider setting product level during parse
039: super (netAgent, netConnection, new ProductLevel(
040: netConnection.productID_,
041: netConnection.targetSrvclsnm_,
042: netConnection.targetSrvrlslv_));
043: // Set up cheat-links
044: netAgent_ = netAgent;
045: }
046:
047: //---------------------------call-down methods--------------------------------
048:
049: public String getURL_() throws SqlException {
050: String urlProtocol;
051:
052: urlProtocol = Configuration.jdbcDerbyNETProtocol;
053:
054: return urlProtocol + connection_.serverNameIP_ + ":"
055: + connection_.portNumber_ + "/"
056: + connection_.databaseName_;
057: }
058:
059: //-----------------------------helper methods---------------------------------
060:
061: // Set flags describing the level of support for this connection.
062: // Flags will be set based on manager level and/or specific product identifiers.
063: // Support for a specific server version can be set as follows. For example
064: // if (productLevel_.greaterThanOrEqualTo(11,1,0))
065: // supportsTheBestThingEver = true
066: //
067: // WARNING WARNING WARNING !!!!
068: //
069: // If you define an instance variable of NetDatabaseMetaData that
070: // you want computeFeatureSet_() to compute, DO NOT assign an
071: // initial value to the variable in the
072: // declaration. NetDatabaseMetaData's constructor will invoke
073: // DatabaseMetaData's constructor, which then invokes
074: // computeFeatureSet_(). Initialization of instance variables in
075: // NetDatabaseMetaData will happen *after* the invocation of
076: // computeFeatureSet_() and will therefore overwrite the computed
077: // values. So, LEAVE INSTANCE VARIABLES UNINITIALIZED!
078: //
079: // END OF WARNING
080: protected void computeFeatureSet_() {
081:
082: // Support for QRYCLSIMP was added in 10.2.0
083: if (productLevel_.greaterThanOrEqualTo(10, 2, 0)) {
084: supportsQryclsimp_ = true;
085: } else {
086: supportsQryclsimp_ = false;
087: }
088: }
089:
090: /**
091: * Check whether the server has full support for the QRYCLSIMP
092: * parameter in OPNQRY.
093: *
094: * @return true if QRYCLSIMP is fully supported
095: */
096: final boolean serverSupportsQryclsimp() {
097: return supportsQryclsimp_;
098: }
099:
100: }
|