0001: /**
0002: * Sequoia: Database clustering technology.
0003: * Copyright (C) 2002-2004 French National Institute For Research In Computer
0004: * Science And Control (INRIA).
0005: * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
0006: * Contact: sequoia@continuent.org
0007: *
0008: * Licensed under the Apache License, Version 2.0 (the "License");
0009: * you may not use this file except in compliance with the License.
0010: * You may obtain a copy of the License at
0011: *
0012: * http://www.apache.org/licenses/LICENSE-2.0
0013: *
0014: * Unless required by applicable law or agreed to in writing, software
0015: * distributed under the License is distributed on an "AS IS" BASIS,
0016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0017: * See the License for the specific language governing permissions and
0018: * limitations under the License.
0019: *
0020: * Initial developer(s): Emmanuel Cecchet.
0021: * Contributor(s): Jean-Bernard van Zuylen
0022: */package org.continuent.sequoia.driver;
0023:
0024: import java.sql.SQLException;
0025: import java.util.HashMap;
0026:
0027: import org.continuent.sequoia.common.sql.metadata.MetadataContainer;
0028: import org.continuent.sequoia.common.sql.metadata.MetadataDescription;
0029: import org.continuent.sequoia.common.util.Constants;
0030:
0031: /**
0032: * DatabaseMetaData retrieves most of the values from the Sequoia controller. If
0033: * you are using an heterogeneous cluster, the values returned are the one of
0034: * the first database that was enabled on the controller.
0035: *
0036: * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
0037: * @author <a href="mailto:jbvanzuylen@transwide.com">Jean-Bernard van Zuylen
0038: * </a>
0039: * @version 1.0
0040: */
0041: public class DatabaseMetaData implements java.sql.DatabaseMetaData {
0042: /** The connection association */
0043: private Connection connection;
0044:
0045: /**
0046: * ("getXXX(Y,Z,...)", value) hash table of the metadata queries.
0047: */
0048: private HashMap metadataContainer;
0049:
0050: /**
0051: * Creates a new <code>DatabaseMetaData</code> instance.
0052: *
0053: * @param conn a <code>Connection</code> value
0054: */
0055: public DatabaseMetaData(Connection conn) {
0056: this .connection = conn;
0057: metadataContainer = new HashMap();
0058: }
0059:
0060: /**
0061: * Lazy evaluation of a static metadata value. If the value is already in the
0062: * hash table, we return it. Else we send a network request to the controller
0063: * and add it to the table. <br>
0064: *
0065: * @param methodName metadata method name
0066: * @param parametersType parameters type of method to invoke
0067: * @param arguments arguments to invoke the method
0068: * @param allowsNull true if a null metadata can be returned, if set to false
0069: * an exception will be thrown if the metadata is null
0070: * @return the value returned by the given method
0071: * @throws SQLException if the connection fails
0072: */
0073: private Object getMetadata(String methodName,
0074: Class[] parametersType, Object[] arguments,
0075: boolean allowsNull) throws SQLException {
0076: String key = MetadataContainer.getContainerKey(methodName,
0077: parametersType, arguments);
0078: Object value = metadataContainer.get(key);
0079:
0080: if (value == null) { // Value not yet in container
0081: value = connection.getStaticMetadata(key);
0082: if ((value == null) && !allowsNull)
0083: throw new SQLException(
0084: "Unable to retrieve metadata for " + key);
0085: metadataContainer.put(key, value);
0086: }
0087: return value;
0088: }
0089:
0090: /**
0091: * @see java.sql.DatabaseMetaData#allProceduresAreCallable()
0092: */
0093: public boolean allProceduresAreCallable() throws SQLException {
0094: return ((Boolean) getMetadata(
0095: MetadataDescription.ALL_PROCEDURES_ARE_CALLABLE, null,
0096: null, false)).booleanValue();
0097: }
0098:
0099: /**
0100: * @see java.sql.DatabaseMetaData#allTablesAreSelectable()
0101: */
0102: public boolean allTablesAreSelectable() throws SQLException {
0103: return ((Boolean) getMetadata(
0104: MetadataDescription.ALL_TABLES_ARE_SELECTABLE, null,
0105: null, false)).booleanValue();
0106: }
0107:
0108: /**
0109: * @see java.sql.DatabaseMetaData#dataDefinitionCausesTransactionCommit()
0110: */
0111: public boolean dataDefinitionCausesTransactionCommit()
0112: throws SQLException {
0113: return ((Boolean) getMetadata(
0114: MetadataDescription.DATA_DEFINITION_CAUSES_TRANSACTION_COMMIT,
0115: null, null, false)).booleanValue();
0116: }
0117:
0118: /**
0119: * @see java.sql.DatabaseMetaData#dataDefinitionIgnoredInTransactions()
0120: */
0121: public boolean dataDefinitionIgnoredInTransactions()
0122: throws SQLException {
0123: return ((Boolean) getMetadata(
0124: MetadataDescription.DATA_DEFINITION_IGNORED_IN_TRANSACTIONS,
0125: null, null, false)).booleanValue();
0126: }
0127:
0128: /**
0129: * @see java.sql.DatabaseMetaData#deletesAreDetected(int)
0130: */
0131: public boolean deletesAreDetected(int type) throws SQLException {
0132: return ((Boolean) getMetadata(
0133: MetadataDescription.DELETES_ARE_DETECTED,
0134: new Class[] { Integer.TYPE },
0135: new Object[] { new Integer(type) }, false))
0136: .booleanValue();
0137: }
0138:
0139: /**
0140: * @see java.sql.DatabaseMetaData#doesMaxRowSizeIncludeBlobs()
0141: */
0142: public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
0143: return ((Boolean) getMetadata(
0144: MetadataDescription.DOES_MAX_ROW_SIZE_INCLUDE_BLOBS,
0145: null, null, false)).booleanValue();
0146: }
0147:
0148: /**
0149: * @see java.sql.DatabaseMetaData#getBestRowIdentifier(java.lang.String,
0150: * java.lang.String, java.lang.String, int, boolean)
0151: */
0152: public java.sql.ResultSet getBestRowIdentifier(String catalog,
0153: String schema, String table, int scope, boolean nullable)
0154: throws SQLException {
0155: return connection.getBestRowIdentifier(catalog, schema, table,
0156: scope, nullable);
0157: }
0158:
0159: /**
0160: * @see java.sql.DatabaseMetaData#getCatalogs()
0161: */
0162: public java.sql.ResultSet getCatalogs() throws SQLException {
0163: return connection.getCatalogs();
0164: }
0165:
0166: /**
0167: * @see java.sql.DatabaseMetaData#getCatalogSeparator()
0168: */
0169: public String getCatalogSeparator() throws SQLException {
0170: return ((String) getMetadata(
0171: MetadataDescription.GET_CATALOG_SEPARATOR, null, null,
0172: true));
0173: }
0174:
0175: /**
0176: * @see java.sql.DatabaseMetaData#getCatalogTerm()
0177: */
0178: public String getCatalogTerm() throws SQLException {
0179: return ((String) getMetadata(
0180: MetadataDescription.GET_CATALOG_TERM, null, null, true));
0181: }
0182:
0183: /**
0184: * @param catalog a catalog name; "" retrieves those without a catalog
0185: * @param schemaPattern a schema name pattern; "" retrieves those without a
0186: * schema
0187: * @param tableNamePattern a table name pattern
0188: * @param columnNamePattern a column name pattern
0189: * @return <code>null</code>
0190: * @exception SQLException if an error occurs
0191: * @see #getSearchStringEscape
0192: */
0193: public java.sql.ResultSet getColumns(String catalog,
0194: String schemaPattern, String tableNamePattern,
0195: String columnNamePattern) throws SQLException {
0196: return connection.getColumns(catalog, schemaPattern,
0197: tableNamePattern, columnNamePattern);
0198: }
0199:
0200: /**
0201: * @see java.sql.DatabaseMetaData#getColumnPrivileges(java.lang.String,
0202: * java.lang.String, java.lang.String, java.lang.String)
0203: */
0204: public java.sql.ResultSet getColumnPrivileges(String catalog,
0205: String schemaPattern, String tableNamePattern,
0206: String columnNamePattern) throws SQLException {
0207: return connection.getColumnPrivileges(catalog, schemaPattern,
0208: tableNamePattern, columnNamePattern);
0209: }
0210:
0211: /**
0212: * Retrieves the <code>Connection</code> that produced this
0213: * <code>DatabaseMetaData</code>.
0214: *
0215: * @return the <code>Connection</code> object
0216: * @exception SQLException if an error occurs
0217: */
0218: public java.sql.Connection getConnection() throws SQLException {
0219: return connection;
0220: }
0221:
0222: /**
0223: * @see java.sql.DatabaseMetaData#getCrossReference(java.lang.String,
0224: * java.lang.String, java.lang.String, java.lang.String,
0225: * java.lang.String, java.lang.String)
0226: */
0227: public java.sql.ResultSet getCrossReference(String primaryCatalog,
0228: String primarySchema, String primaryTable,
0229: String foreignCatalog, String foreignSchema,
0230: String foreignTable) throws SQLException {
0231: return connection.getCrossReference(primaryCatalog,
0232: primarySchema, primaryTable, foreignCatalog,
0233: foreignSchema, foreignTable);
0234: }
0235:
0236: /**
0237: * We return a comma separated list of database engine names connected to the
0238: * controller. A name appears only once regardless of the number of instances
0239: * of this particular db engine. If no database product name is provided by
0240: * the backend drivers, default is to return "Sequoia Controller".
0241: *
0242: * @return comma separated list of database product names
0243: * @exception SQLException if a database access error occurs
0244: */
0245: public String getDatabaseProductName() throws SQLException {
0246: return connection.getDatabaseProductName();
0247: }
0248:
0249: /**
0250: * What is the version of this database product.
0251: *
0252: * @return the Sequoia driver version
0253: * @exception SQLException if an error occurs
0254: */
0255: public String getDatabaseProductVersion() throws SQLException {
0256: return connection.getControllerVersionNumber();
0257: }
0258:
0259: /**
0260: * @see java.sql.DatabaseMetaData#getDefaultTransactionIsolation()
0261: */
0262: public int getDefaultTransactionIsolation() throws SQLException {
0263: return ((Integer) getMetadata(
0264: MetadataDescription.GET_DEFAULT_TRANSACTION_ISOLATION,
0265: null, null, false)).intValue();
0266: }
0267:
0268: /**
0269: * What is this JDBC driver's major version number?
0270: *
0271: * @return the JDBC driver major version
0272: */
0273: public int getDriverMajorVersion() {
0274: return Driver.MAJOR_VERSION;
0275: }
0276:
0277: /**
0278: * What is this JDBC driver's minor version number?
0279: *
0280: * @return the JDBC driver minor version
0281: */
0282: public int getDriverMinorVersion() {
0283: return Driver.MINOR_VERSION;
0284: }
0285:
0286: /**
0287: * What is the name of this JDBC driver?
0288: *
0289: * @return the JDBC driver name
0290: * @exception SQLException why?
0291: */
0292: public String getDriverName() throws SQLException {
0293: return "Sequoia Generic Driver";
0294: }
0295:
0296: /**
0297: * What is the version string of this JDBC driver?
0298: *
0299: * @return the JDBC driver name.
0300: * @exception SQLException why?
0301: */
0302: public String getDriverVersion() throws SQLException {
0303: return Constants.VERSION;
0304: }
0305:
0306: /**
0307: * @see java.sql.DatabaseMetaData#getExportedKeys(java.lang.String,
0308: * java.lang.String, java.lang.String)
0309: */
0310: public java.sql.ResultSet getExportedKeys(String catalog,
0311: String schema, String table) throws SQLException {
0312: return connection.getExportedKeys(catalog, schema, table);
0313: }
0314:
0315: /**
0316: * @see java.sql.DatabaseMetaData#getExtraNameCharacters()
0317: */
0318: public String getExtraNameCharacters() throws SQLException {
0319: return ((String) getMetadata(
0320: MetadataDescription.GET_EXTRA_NAME_CHARACTERS, null,
0321: null, true));
0322: }
0323:
0324: /**
0325: * @see java.sql.DatabaseMetaData#getIdentifierQuoteString()
0326: */
0327: public String getIdentifierQuoteString() throws SQLException {
0328: return ((String) getMetadata(
0329: MetadataDescription.GET_IDENTIFIER_QUOTE_STRING, null,
0330: null, true));
0331: }
0332:
0333: /**
0334: * @see java.sql.DatabaseMetaData#getImportedKeys(java.lang.String,
0335: * java.lang.String, java.lang.String)
0336: */
0337: public java.sql.ResultSet getImportedKeys(String catalog,
0338: String schema, String table) throws SQLException {
0339: return connection.getImportedKeys(catalog, schema, table);
0340: }
0341:
0342: /**
0343: * @see java.sql.DatabaseMetaData#getIndexInfo(java.lang.String,
0344: * java.lang.String, java.lang.String, boolean, boolean)
0345: */
0346: public java.sql.ResultSet getIndexInfo(String catalog,
0347: String schema, String table, boolean unique,
0348: boolean approximate) throws SQLException {
0349: return connection.getIndexInfo(catalog, schema, table, unique,
0350: approximate);
0351: }
0352:
0353: /**
0354: * @see java.sql.DatabaseMetaData#getMaxBinaryLiteralLength()
0355: */
0356: public int getMaxBinaryLiteralLength() throws SQLException {
0357: return ((Integer) getMetadata(
0358: MetadataDescription.GET_MAX_BINARY_LITERAL_LENGTH,
0359: null, null, false)).intValue();
0360:
0361: }
0362:
0363: /**
0364: * @see java.sql.DatabaseMetaData#getMaxCatalogNameLength()
0365: */
0366: public int getMaxCatalogNameLength() throws SQLException {
0367: return ((Integer) getMetadata(
0368: MetadataDescription.GET_MAX_CATALOG_NAME_LENGTH, null,
0369: null, false)).intValue();
0370: }
0371:
0372: /**
0373: * @see java.sql.DatabaseMetaData#getMaxCharLiteralLength()
0374: */
0375: public int getMaxCharLiteralLength() throws SQLException {
0376: return ((Integer) getMetadata(
0377: MetadataDescription.GET_MAX_CHAR_LITERAL_LENGTH, null,
0378: null, false)).intValue();
0379: }
0380:
0381: /**
0382: * @see java.sql.DatabaseMetaData#getMaxColumnNameLength()
0383: */
0384: public int getMaxColumnNameLength() throws SQLException {
0385: return ((Integer) getMetadata(
0386: MetadataDescription.GET_MAX_COLUMN_NAME_LENGTH, null,
0387: null, false)).intValue();
0388: }
0389:
0390: /**
0391: * @see java.sql.DatabaseMetaData#getMaxColumnsInGroupBy()
0392: */
0393: public int getMaxColumnsInGroupBy() throws SQLException {
0394: return ((Integer) getMetadata(
0395: MetadataDescription.GET_MAX_COLUMNS_IN_GROUP_BY, null,
0396: null, false)).intValue();
0397: }
0398:
0399: /**
0400: * @see java.sql.DatabaseMetaData#getMaxColumnsInIndex()
0401: */
0402: public int getMaxColumnsInIndex() throws SQLException {
0403: return ((Integer) getMetadata(
0404: MetadataDescription.GET_MAX_COLUMNS_IN_INDEX, null,
0405: null, false)).intValue();
0406: }
0407:
0408: /**
0409: * @see java.sql.DatabaseMetaData#getMaxColumnsInOrderBy()
0410: */
0411: public int getMaxColumnsInOrderBy() throws SQLException {
0412: return ((Integer) getMetadata(
0413: MetadataDescription.GET_MAX_COLUMNS_IN_ORDER_BY, null,
0414: null, false)).intValue();
0415: }
0416:
0417: /**
0418: * @see java.sql.DatabaseMetaData#getMaxColumnsInSelect()
0419: */
0420: public int getMaxColumnsInSelect() throws SQLException {
0421: return ((Integer) getMetadata(
0422: MetadataDescription.GET_MAX_COLUMNS_IN_SELECT, null,
0423: null, false)).intValue();
0424: }
0425:
0426: /**
0427: * @see java.sql.DatabaseMetaData#getMaxColumnsInTable()
0428: */
0429: public int getMaxColumnsInTable() throws SQLException {
0430: return ((Integer) getMetadata(
0431: MetadataDescription.GET_MAX_COLUMNS_IN_TABLE, null,
0432: null, false)).intValue();
0433: }
0434:
0435: /**
0436: * Maximum number of connections to the database (virtually no limit since
0437: * these are virtual connections to the Controller). The spec says 0 should be
0438: * returned if unknown.
0439: *
0440: * @return value retrieved from first enabled backend
0441: * @exception SQLException if a database access error occurs
0442: */
0443: public int getMaxConnections() throws SQLException {
0444: // TODO: max connection should be the max number of connection to the
0445: // virtual database
0446: return ((Integer) getMetadata(
0447: MetadataDescription.GET_MAX_CONNECTIONS, null, null,
0448: false)).intValue();
0449: }
0450:
0451: /**
0452: * @see java.sql.DatabaseMetaData#getMaxCursorNameLength()
0453: */
0454: public int getMaxCursorNameLength() throws SQLException {
0455: return ((Integer) getMetadata(
0456: MetadataDescription.GET_MAX_CURSOR_NAME_LENGTH, null,
0457: null, false)).intValue();
0458: }
0459:
0460: /**
0461: * @see java.sql.DatabaseMetaData#getMaxIndexLength()
0462: */
0463: public int getMaxIndexLength() throws SQLException {
0464: return ((Integer) getMetadata(
0465: MetadataDescription.GET_MAX_INDEX_LENGTH, null, null,
0466: false)).intValue();
0467: }
0468:
0469: /**
0470: * @see java.sql.DatabaseMetaData#getMaxProcedureNameLength()
0471: */
0472: public int getMaxProcedureNameLength() throws SQLException {
0473: return ((Integer) getMetadata(
0474: MetadataDescription.GET_MAX_PROCEDURE_NAME_LENGTH,
0475: null, null, false)).intValue();
0476: }
0477:
0478: /**
0479: * @see java.sql.DatabaseMetaData#getMaxRowSize()
0480: */
0481: public int getMaxRowSize() throws SQLException {
0482: return ((Integer) getMetadata(
0483: MetadataDescription.GET_MAX_ROW_SIZE, null, null, false))
0484: .intValue();
0485: }
0486:
0487: /**
0488: * @see java.sql.DatabaseMetaData#getMaxSchemaNameLength()
0489: */
0490: public int getMaxSchemaNameLength() throws SQLException {
0491: return ((Integer) getMetadata(
0492: MetadataDescription.GET_MAX_SCHEMA_NAME_LENGTH, null,
0493: null, false)).intValue();
0494: }
0495:
0496: /**
0497: * @see java.sql.DatabaseMetaData#getMaxStatementLength()
0498: */
0499: public int getMaxStatementLength() throws SQLException {
0500: return ((Integer) getMetadata(
0501: MetadataDescription.GET_MAX_STATEMENT_LENGTH, null,
0502: null, false)).intValue();
0503: }
0504:
0505: /**
0506: * @see java.sql.DatabaseMetaData#getMaxStatements()
0507: */
0508: public int getMaxStatements() throws SQLException {
0509: return ((Integer) getMetadata(
0510: MetadataDescription.GET_MAX_STATEMENTS, null, null,
0511: false)).intValue();
0512: }
0513:
0514: /**
0515: * @see java.sql.DatabaseMetaData#getMaxTableNameLength()
0516: */
0517: public int getMaxTableNameLength() throws SQLException {
0518: return ((Integer) getMetadata(
0519: MetadataDescription.GET_MAX_TABLE_NAME_LENGTH, null,
0520: null, false)).intValue();
0521: }
0522:
0523: /**
0524: * @see java.sql.DatabaseMetaData#getMaxTablesInSelect()
0525: */
0526: public int getMaxTablesInSelect() throws SQLException {
0527: return ((Integer) getMetadata(
0528: MetadataDescription.GET_MAX_TABLES_IN_SELECT, null,
0529: null, false)).intValue();
0530: }
0531:
0532: /**
0533: * @see java.sql.DatabaseMetaData#getMaxUserNameLength()
0534: */
0535: public int getMaxUserNameLength() throws SQLException {
0536: return ((Integer) getMetadata(
0537: MetadataDescription.GET_MAX_USER_NAME_LENGTH, null,
0538: null, false)).intValue();
0539: }
0540:
0541: /**
0542: * @see java.sql.DatabaseMetaData#getNumericFunctions()
0543: */
0544: public String getNumericFunctions() throws SQLException {
0545: return ((String) getMetadata(
0546: MetadataDescription.GET_NUMERIC_FUNCTIONS, null, null,
0547: true));
0548: }
0549:
0550: /**
0551: * @see java.sql.DatabaseMetaData#getPrimaryKeys(java.lang.String,
0552: * java.lang.String, java.lang.String)
0553: */
0554: public java.sql.ResultSet getPrimaryKeys(String catalog,
0555: String schema, String table) throws SQLException {
0556: return connection.getPrimaryKeys(catalog, schema, table);
0557: }
0558:
0559: /**
0560: * @see java.sql.DatabaseMetaData#getProcedureColumns(java.lang.String,
0561: * java.lang.String, java.lang.String, java.lang.String)
0562: */
0563: public java.sql.ResultSet getProcedureColumns(String catalog,
0564: String schemaPattern, String procedureNamePattern,
0565: String columnNamePattern) throws SQLException {
0566: return connection.getProcedureColumns(catalog, schemaPattern,
0567: procedureNamePattern, columnNamePattern);
0568: }
0569:
0570: /**
0571: * @see java.sql.DatabaseMetaData#getProcedures(java.lang.String,
0572: * java.lang.String, java.lang.String)
0573: */
0574: public java.sql.ResultSet getProcedures(String catalog,
0575: String schemaPattern, String procedureNamePattern)
0576: throws SQLException {
0577: return connection.getProcedures(catalog, schemaPattern,
0578: procedureNamePattern);
0579: }
0580:
0581: /**
0582: * @see java.sql.DatabaseMetaData#getProcedureTerm()
0583: */
0584: public String getProcedureTerm() throws SQLException {
0585: return ((String) getMetadata(
0586: MetadataDescription.GET_PROCEDURE_TERM, null, null,
0587: true));
0588: }
0589:
0590: /**
0591: * @see java.sql.DatabaseMetaData#getSchemas()
0592: */
0593: public java.sql.ResultSet getSchemas() throws SQLException {
0594: return connection.getSchemas();
0595: }
0596:
0597: /**
0598: * @see java.sql.DatabaseMetaData#getSchemaTerm()
0599: */
0600: public String getSchemaTerm() throws SQLException {
0601: return ((String) getMetadata(
0602: MetadataDescription.GET_SCHEMA_TERM, null, null, true));
0603: }
0604:
0605: /**
0606: * @see java.sql.DatabaseMetaData#getSearchStringEscape()
0607: */
0608: public String getSearchStringEscape() throws SQLException {
0609: return ((String) getMetadata(
0610: MetadataDescription.GET_SEARCH_STRING_ESCAPE, null,
0611: null, true));
0612: }
0613:
0614: /**
0615: * @see java.sql.DatabaseMetaData#getSQLKeywords()
0616: */
0617: public String getSQLKeywords() throws SQLException {
0618: return ((String) getMetadata(
0619: MetadataDescription.GET_SQL_KEYWORDS, null, null, true));
0620: }
0621:
0622: /**
0623: * @see java.sql.DatabaseMetaData#getStringFunctions()
0624: */
0625: public String getStringFunctions() throws SQLException {
0626: return ((String) getMetadata(
0627: MetadataDescription.GET_STRING_FUNCTIONS, null, null,
0628: true));
0629: }
0630:
0631: /**
0632: * @see java.sql.DatabaseMetaData#getSystemFunctions()
0633: */
0634: public String getSystemFunctions() throws SQLException {
0635: return ((String) getMetadata(
0636: MetadataDescription.GET_SYSTEM_FUNCTIONS, null, null,
0637: true));
0638: }
0639:
0640: /**
0641: * Gets a description of the available tables.
0642: *
0643: * @param catalog a catalog name; this is ignored, and should be set to
0644: * <code>null</code>
0645: * @param schemaPattern a schema name pattern; this is ignored, and should be
0646: * set to <code>null</code>
0647: * @param tableNamePattern a table name pattern. For all tables this should be
0648: * "%"
0649: * @param types a list of table types to include; <code>null</code> returns
0650: * all types
0651: * @return <code>null</code>
0652: * @exception SQLException if a database-access error occurs.
0653: */
0654: public java.sql.ResultSet getTables(String catalog,
0655: String schemaPattern, String tableNamePattern,
0656: String[] types) throws SQLException {
0657: return connection.getTables(catalog, schemaPattern,
0658: tableNamePattern, types);
0659: }
0660:
0661: /**
0662: * Gets a description of the access rights for each table available in a
0663: * catalog. Note that a table privilege applies to one or more columns in the
0664: * table. It would be wrong to assume that this priviledge applies to all
0665: * columns (this may be true for some systems but is not true for all.) Only
0666: * privileges matching the schema and table name criteria are returned. They
0667: * are ordered by TABLE_SCHEM, TABLE_NAME, and PRIVILEGE.
0668: *
0669: * @param catalog a catalog name; "" retrieves those without a catalog; null
0670: * means drop catalog name from the selection criteria
0671: * @param schemaPattern a schema name pattern; "" retrieves those without a
0672: * schema
0673: * @param tableNamePattern a table name pattern
0674: * @return <code>ResultSet</code> each row is a table privilege description
0675: * @throws SQLException if a database access error occurs
0676: */
0677: public java.sql.ResultSet getTablePrivileges(String catalog,
0678: String schemaPattern, String tableNamePattern)
0679: throws SQLException {
0680: return connection.getTablePrivileges(catalog, schemaPattern,
0681: tableNamePattern);
0682: }
0683:
0684: /**
0685: * Gets the table types available in this database. The results are ordered by
0686: * table type.
0687: *
0688: * @return <code>ResultSet</code> each row has a single String column that
0689: * is a catalog name
0690: * @throws SQLException if a database error occurs
0691: */
0692: public java.sql.ResultSet getTableTypes() throws SQLException {
0693: return connection.getTableTypes();
0694: }
0695:
0696: /**
0697: * @see java.sql.DatabaseMetaData#getTimeDateFunctions()
0698: */
0699: public String getTimeDateFunctions() throws SQLException {
0700: return ((String) getMetadata(
0701: MetadataDescription.GET_TIME_DATE_FUNCTIONS, null,
0702: null, true));
0703: }
0704:
0705: /**
0706: * @see java.sql.DatabaseMetaData#getTypeInfo()
0707: */
0708: public java.sql.ResultSet getTypeInfo() throws SQLException {
0709: return connection.getTypeInfo();
0710: }
0711:
0712: /**
0713: * @see java.sql.DatabaseMetaData#getUDTs(java.lang.String, java.lang.String,
0714: * java.lang.String, int[])
0715: */
0716: public java.sql.ResultSet getUDTs(String catalog,
0717: String schemaPattern, String typeNamePattern, int[] types)
0718: throws SQLException {
0719: return connection.getUDTs(catalog, schemaPattern,
0720: typeNamePattern, types);
0721: }
0722:
0723: /**
0724: * What is the URL for this database?
0725: *
0726: * @return the url or null if it cannott be generated
0727: * @exception SQLException if a database access error occurs
0728: */
0729: public String getURL() throws SQLException {
0730: return connection.getUrl();
0731: }
0732:
0733: /**
0734: * What is our user name as known to the database?
0735: *
0736: * @return our database user name
0737: * @exception SQLException if a database access error occurs
0738: */
0739: public String getUserName() throws SQLException {
0740: return connection.getUserName();
0741: }
0742:
0743: /**
0744: * @see java.sql.DatabaseMetaData#getVersionColumns(java.lang.String,
0745: * java.lang.String, java.lang.String)
0746: */
0747: public java.sql.ResultSet getVersionColumns(String catalog,
0748: String schema, String table) throws SQLException {
0749: return connection.getVersionColumns(catalog, schema, table);
0750: }
0751:
0752: /**
0753: * @see java.sql.DatabaseMetaData#insertsAreDetected(int)
0754: */
0755: public boolean insertsAreDetected(int type) throws SQLException {
0756: return ((Boolean) getMetadata(
0757: MetadataDescription.INSERTS_ARE_DETECTED,
0758: new Class[] { Integer.TYPE },
0759: new Object[] { new Integer(type) }, false))
0760: .booleanValue();
0761: }
0762:
0763: /**
0764: * @see java.sql.DatabaseMetaData#isCatalogAtStart()
0765: */
0766: public boolean isCatalogAtStart() throws SQLException {
0767: return ((Boolean) getMetadata(
0768: MetadataDescription.IS_CATALOG_AT_START, null, null,
0769: false)).booleanValue();
0770: }
0771:
0772: /**
0773: * Is the database in read-only mode?
0774: *
0775: * @return <code>true</code> if so
0776: * @exception SQLException if a database access error occurs
0777: */
0778: public boolean isReadOnly() throws SQLException {
0779: return connection.isReadOnly();
0780: }
0781:
0782: /**
0783: * @see java.sql.DatabaseMetaData#nullPlusNonNullIsNull()
0784: */
0785: public boolean nullPlusNonNullIsNull() throws SQLException {
0786: return ((Boolean) getMetadata(
0787: MetadataDescription.NULL_PLUS_NON_NULL_IS_NULL, null,
0788: null, false)).booleanValue();
0789: }
0790:
0791: /**
0792: * @see java.sql.DatabaseMetaData#nullsAreSortedAtEnd()
0793: */
0794: public boolean nullsAreSortedAtEnd() throws SQLException {
0795: return ((Boolean) getMetadata(
0796: MetadataDescription.NULLS_ARE_SORTED_AT_END, null,
0797: null, false)).booleanValue();
0798: }
0799:
0800: /**
0801: * @see java.sql.DatabaseMetaData#nullsAreSortedAtStart()
0802: */
0803: public boolean nullsAreSortedAtStart() throws SQLException {
0804: return ((Boolean) getMetadata(
0805: MetadataDescription.NULLS_ARE_SORTED_AT_START, null,
0806: null, false)).booleanValue();
0807: }
0808:
0809: /**
0810: * @see java.sql.DatabaseMetaData#nullsAreSortedHigh()
0811: */
0812: public boolean nullsAreSortedHigh() throws SQLException {
0813: return ((Boolean) getMetadata(
0814: MetadataDescription.NULLS_ARE_SORTED_HIGH, null, null,
0815: false)).booleanValue();
0816: }
0817:
0818: /**
0819: * @see java.sql.DatabaseMetaData#nullsAreSortedLow()
0820: */
0821: public boolean nullsAreSortedLow() throws SQLException {
0822: return ((Boolean) getMetadata(
0823: MetadataDescription.NULLS_ARE_SORTED_LOW, null, null,
0824: false)).booleanValue();
0825: }
0826:
0827: /**
0828: * @see java.sql.DatabaseMetaData#othersDeletesAreVisible(int)
0829: */
0830: public boolean othersDeletesAreVisible(int type)
0831: throws SQLException {
0832: return ((Boolean) getMetadata(
0833: MetadataDescription.OTHERS_DELETES_ARE_VISIBLE,
0834: new Class[] { Integer.TYPE },
0835: new Object[] { new Integer(type) }, false))
0836: .booleanValue();
0837: }
0838:
0839: /**
0840: * @see java.sql.DatabaseMetaData#othersInsertsAreVisible(int)
0841: */
0842: public boolean othersInsertsAreVisible(int type)
0843: throws SQLException {
0844: return ((Boolean) getMetadata(
0845: MetadataDescription.OTHERS_INSERTS_ARE_VISIBLE,
0846: new Class[] { Integer.TYPE },
0847: new Object[] { new Integer(type) }, false))
0848: .booleanValue();
0849: }
0850:
0851: /**
0852: * @see java.sql.DatabaseMetaData#othersUpdatesAreVisible(int)
0853: */
0854: public boolean othersUpdatesAreVisible(int type)
0855: throws SQLException {
0856: return ((Boolean) getMetadata(
0857: MetadataDescription.OTHERS_UPDATES_ARE_VISIBLE,
0858: new Class[] { Integer.TYPE },
0859: new Object[] { new Integer(type) }, false))
0860: .booleanValue();
0861: }
0862:
0863: /**
0864: * @see java.sql.DatabaseMetaData#ownDeletesAreVisible(int)
0865: */
0866: public boolean ownDeletesAreVisible(int type) throws SQLException {
0867: return ((Boolean) getMetadata(
0868: MetadataDescription.OWN_DELETES_ARE_VISIBLE,
0869: new Class[] { Integer.TYPE },
0870: new Object[] { new Integer(type) }, false))
0871: .booleanValue();
0872: }
0873:
0874: /**
0875: * @see java.sql.DatabaseMetaData#ownInsertsAreVisible(int)
0876: */
0877: public boolean ownInsertsAreVisible(int type) throws SQLException {
0878: return ((Boolean) getMetadata(
0879: MetadataDescription.OWN_INSERTS_ARE_VISIBLE,
0880: new Class[] { Integer.TYPE },
0881: new Object[] { new Integer(type) }, false))
0882: .booleanValue();
0883:
0884: }
0885:
0886: /**
0887: * @see java.sql.DatabaseMetaData#ownUpdatesAreVisible(int)
0888: */
0889: public boolean ownUpdatesAreVisible(int type) throws SQLException {
0890: return ((Boolean) getMetadata(
0891: MetadataDescription.OWN_UPDATES_ARE_VISIBLE,
0892: new Class[] { Integer.TYPE },
0893: new Object[] { new Integer(type) }, false))
0894: .booleanValue();
0895: }
0896:
0897: /**
0898: * @see java.sql.DatabaseMetaData#storesLowerCaseIdentifiers()
0899: */
0900: public boolean storesLowerCaseIdentifiers() throws SQLException {
0901: return ((Boolean) getMetadata(
0902: MetadataDescription.STORES_LOWER_CASE_IDENTIFIERS,
0903: null, null, false)).booleanValue();
0904: }
0905:
0906: /**
0907: * @see java.sql.DatabaseMetaData#storesLowerCaseQuotedIdentifiers()
0908: */
0909: public boolean storesLowerCaseQuotedIdentifiers()
0910: throws SQLException {
0911: return ((Boolean) getMetadata(
0912: MetadataDescription.STORES_LOWER_CASE_QUOTED_IDENTIFIERS,
0913: null, null, false)).booleanValue();
0914: }
0915:
0916: /**
0917: * @see java.sql.DatabaseMetaData#storesMixedCaseIdentifiers()
0918: */
0919: public boolean storesMixedCaseIdentifiers() throws SQLException {
0920: return ((Boolean) getMetadata(
0921: MetadataDescription.STORES_MIXED_CASE_IDENTIFIERS,
0922: null, null, false)).booleanValue();
0923: }
0924:
0925: /**
0926: * @see java.sql.DatabaseMetaData#storesMixedCaseQuotedIdentifiers()
0927: */
0928: public boolean storesMixedCaseQuotedIdentifiers()
0929: throws SQLException {
0930: return ((Boolean) getMetadata(
0931: MetadataDescription.STORES_MIXED_CASE_QUOTED_IDENTIFIERS,
0932: null, null, false)).booleanValue();
0933: }
0934:
0935: /**
0936: * @see java.sql.DatabaseMetaData#storesUpperCaseIdentifiers()
0937: */
0938: public boolean storesUpperCaseIdentifiers() throws SQLException {
0939: return ((Boolean) getMetadata(
0940: MetadataDescription.STORES_UPPER_CASE_IDENTIFIERS,
0941: null, null, false)).booleanValue();
0942: }
0943:
0944: /**
0945: * @see java.sql.DatabaseMetaData#storesUpperCaseQuotedIdentifiers()
0946: */
0947: public boolean storesUpperCaseQuotedIdentifiers()
0948: throws SQLException {
0949: return ((Boolean) getMetadata(
0950: MetadataDescription.STORES_UPPER_CASE_QUOTED_IDENTIFIERS,
0951: null, null, false)).booleanValue();
0952: }
0953:
0954: /**
0955: * @see java.sql.DatabaseMetaData#supportsAlterTableWithAddColumn()
0956: */
0957: public boolean supportsAlterTableWithAddColumn()
0958: throws SQLException {
0959: return ((Boolean) getMetadata(
0960: MetadataDescription.SUPPORTS_ALTER_TABLE_WITH_ADD_COLUMN,
0961: null, null, false)).booleanValue();
0962: }
0963:
0964: /**
0965: * @see java.sql.DatabaseMetaData#supportsAlterTableWithDropColumn()
0966: */
0967: public boolean supportsAlterTableWithDropColumn()
0968: throws SQLException {
0969: return ((Boolean) getMetadata(
0970: MetadataDescription.SUPPORTS_ALTER_TABLE_WITH_DROP_COLUMN,
0971: null, null, false)).booleanValue();
0972: }
0973:
0974: /**
0975: * @see java.sql.DatabaseMetaData#supportsANSI92EntryLevelSQL()
0976: */
0977: public boolean supportsANSI92EntryLevelSQL() throws SQLException {
0978: return ((Boolean) getMetadata(
0979: MetadataDescription.SUPPORTS_ANSI92_ENTRY_LEVEL_SQL,
0980: null, null, false)).booleanValue();
0981: }
0982:
0983: /**
0984: * @see java.sql.DatabaseMetaData#supportsANSI92FullSQL()
0985: */
0986: public boolean supportsANSI92FullSQL() throws SQLException {
0987: return ((Boolean) getMetadata(
0988: MetadataDescription.SUPPORTS_ANSI92_FULL_SQL, null,
0989: null, false)).booleanValue();
0990: }
0991:
0992: /**
0993: * @see java.sql.DatabaseMetaData#supportsANSI92IntermediateSQL()
0994: */
0995: public boolean supportsANSI92IntermediateSQL() throws SQLException {
0996: return ((Boolean) getMetadata(
0997: MetadataDescription.SUPPORTS_ANSI92_INTERMEDIATE_SQL,
0998: null, null, false)).booleanValue();
0999: }
1000:
1001: /**
1002: * @see java.sql.DatabaseMetaData#supportsBatchUpdates()
1003: */
1004: public boolean supportsBatchUpdates() throws SQLException {
1005: return ((Boolean) getMetadata(
1006: MetadataDescription.SUPPORTS_BATCH_UPDATES, null, null,
1007: false)).booleanValue();
1008: }
1009:
1010: /**
1011: * @see java.sql.DatabaseMetaData#supportsCatalogsInDataManipulation()
1012: */
1013: public boolean supportsCatalogsInDataManipulation()
1014: throws SQLException {
1015: return ((Boolean) getMetadata(
1016: MetadataDescription.SUPPORTS_CATALOGS_IN_DATA_MANIPULATION,
1017: null, null, false)).booleanValue();
1018: }
1019:
1020: /**
1021: * @see java.sql.DatabaseMetaData#supportsCatalogsInIndexDefinitions()
1022: */
1023: public boolean supportsCatalogsInIndexDefinitions()
1024: throws SQLException {
1025: return ((Boolean) getMetadata(
1026: MetadataDescription.SUPPORTS_CATALOGS_IN_INDEX_DEFINITIONS,
1027: null, null, false)).booleanValue();
1028: }
1029:
1030: /**
1031: * @see java.sql.DatabaseMetaData#supportsCatalogsInPrivilegeDefinitions()
1032: */
1033: public boolean supportsCatalogsInPrivilegeDefinitions()
1034: throws SQLException {
1035: return ((Boolean) getMetadata(
1036: MetadataDescription.SUPPORTS_CATALOGS_IN_PRIVILEGE_DEFINITIONS,
1037: null, null, false)).booleanValue();
1038: }
1039:
1040: /**
1041: * @see java.sql.DatabaseMetaData#supportsCatalogsInProcedureCalls()
1042: */
1043: public boolean supportsCatalogsInProcedureCalls()
1044: throws SQLException {
1045: return ((Boolean) getMetadata(
1046: MetadataDescription.SUPPORTS_CATALOGS_IN_PROCEDURE_CALLS,
1047: null, null, false)).booleanValue();
1048: }
1049:
1050: /**
1051: * @see java.sql.DatabaseMetaData#supportsCatalogsInTableDefinitions()
1052: */
1053: public boolean supportsCatalogsInTableDefinitions()
1054: throws SQLException {
1055: return ((Boolean) getMetadata(
1056: MetadataDescription.SUPPORTS_CATALOGS_IN_TABLE_DEFINITIONS,
1057: null, null, false)).booleanValue();
1058: }
1059:
1060: /**
1061: * @see java.sql.DatabaseMetaData#supportsColumnAliasing()
1062: */
1063: public boolean supportsColumnAliasing() throws SQLException {
1064: return ((Boolean) getMetadata(
1065: MetadataDescription.SUPPORTS_COLUMN_ALIASING, null,
1066: null, false)).booleanValue();
1067: }
1068:
1069: /**
1070: * @see java.sql.DatabaseMetaData#supportsConvert()
1071: */
1072: public boolean supportsConvert() throws SQLException {
1073: return ((Boolean) getMetadata(
1074: MetadataDescription.SUPPORTS_CONVERT, null, null, false))
1075: .booleanValue();
1076: }
1077:
1078: /**
1079: * Not implemented (returns <code>false</code>). We should ask the
1080: * Controller to know.
1081: *
1082: * @param fromType an <code>int</code> value
1083: * @param toType an <code>int</code> value
1084: * @return <code>false</code>
1085: * @exception SQLException <description>
1086: */
1087: public boolean supportsConvert(int fromType, int toType)
1088: throws SQLException {
1089: return false;
1090: }
1091:
1092: /**
1093: * @see java.sql.DatabaseMetaData#supportsCoreSQLGrammar()
1094: */
1095: public boolean supportsCoreSQLGrammar() throws SQLException {
1096: return ((Boolean) getMetadata(
1097: MetadataDescription.SUPPORTS_CORE_SQL_GRAMMAR, null,
1098: null, false)).booleanValue();
1099: }
1100:
1101: /**
1102: * @see java.sql.DatabaseMetaData#supportsCorrelatedSubqueries()
1103: */
1104: public boolean supportsCorrelatedSubqueries() throws SQLException {
1105: return ((Boolean) getMetadata(
1106: MetadataDescription.SUPPORTS_CORRELATED_SUBQUERIES,
1107: null, null, false)).booleanValue();
1108: }
1109:
1110: /**
1111: * @see java.sql.DatabaseMetaData#supportsDataDefinitionAndDataManipulationTransactions()
1112: */
1113: public boolean supportsDataDefinitionAndDataManipulationTransactions()
1114: throws SQLException {
1115: return ((Boolean) getMetadata(
1116: MetadataDescription.SUPPORTS_DATA_DEFINITION_AND_DATA_MANIPULATION_TRANSACTIONS,
1117: null, null, false)).booleanValue();
1118: }
1119:
1120: /**
1121: * @see java.sql.DatabaseMetaData#supportsDataManipulationTransactionsOnly()
1122: */
1123: public boolean supportsDataManipulationTransactionsOnly()
1124: throws SQLException {
1125: return ((Boolean) getMetadata(
1126: MetadataDescription.SUPPORTS_DATA_MANIPULATION_TRANSACTIONS_ONLY,
1127: null, null, false)).booleanValue();
1128: }
1129:
1130: /**
1131: * @see java.sql.DatabaseMetaData#supportsDifferentTableCorrelationNames()
1132: */
1133: public boolean supportsDifferentTableCorrelationNames()
1134: throws SQLException {
1135: return ((Boolean) getMetadata(
1136: MetadataDescription.SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES,
1137: null, null, false)).booleanValue();
1138: }
1139:
1140: /**
1141: * @see java.sql.DatabaseMetaData#supportsExpressionsInOrderBy()
1142: */
1143: public boolean supportsExpressionsInOrderBy() throws SQLException {
1144: return ((Boolean) getMetadata(
1145: MetadataDescription.SUPPORTS_EXPRESSIONS_IN_ORDER_BY,
1146: null, null, false)).booleanValue();
1147: }
1148:
1149: /**
1150: * @see java.sql.DatabaseMetaData#supportsExtendedSQLGrammar()
1151: */
1152: public boolean supportsExtendedSQLGrammar() throws SQLException {
1153: return ((Boolean) getMetadata(
1154: MetadataDescription.SUPPORTS_EXTENDED_SQL_GRAMMAR,
1155: null, null, false)).booleanValue();
1156: }
1157:
1158: /**
1159: * @see java.sql.DatabaseMetaData#supportsFullOuterJoins()
1160: */
1161: public boolean supportsFullOuterJoins() throws SQLException {
1162: return ((Boolean) getMetadata(
1163: MetadataDescription.SUPPORTS_FULL_OUTER_JOINS, null,
1164: null, false)).booleanValue();
1165: }
1166:
1167: /**
1168: * @see java.sql.DatabaseMetaData#supportsGroupBy()
1169: */
1170: public boolean supportsGroupBy() throws SQLException {
1171: return ((Boolean) getMetadata(
1172: MetadataDescription.SUPPORTS_GROUP_BY, null, null,
1173: false)).booleanValue();
1174: }
1175:
1176: /**
1177: * @see java.sql.DatabaseMetaData#supportsGroupByBeyondSelect()
1178: */
1179: public boolean supportsGroupByBeyondSelect() throws SQLException {
1180: return ((Boolean) getMetadata(
1181: MetadataDescription.SUPPORTS_GROUP_BY_BEYOND_SELECT,
1182: null, null, false)).booleanValue();
1183: }
1184:
1185: /**
1186: * @see java.sql.DatabaseMetaData#supportsGroupByUnrelated()
1187: */
1188: public boolean supportsGroupByUnrelated() throws SQLException {
1189: return ((Boolean) getMetadata(
1190: MetadataDescription.SUPPORTS_GROUP_BY_UNRELATED, null,
1191: null, false)).booleanValue();
1192: }
1193:
1194: /**
1195: * @see java.sql.DatabaseMetaData#supportsIntegrityEnhancementFacility()
1196: */
1197: public boolean supportsIntegrityEnhancementFacility()
1198: throws SQLException {
1199: return ((Boolean) getMetadata(
1200: MetadataDescription.SUPPORTS_INTEGRITY_ENHANCEMENT_FACILITY,
1201: null, null, false)).booleanValue();
1202: }
1203:
1204: /**
1205: * @see java.sql.DatabaseMetaData#supportsLikeEscapeClause()
1206: */
1207: public boolean supportsLikeEscapeClause() throws SQLException {
1208: return ((Boolean) getMetadata(
1209: MetadataDescription.SUPPORTS_LIKE_ESCAPE_CLAUSE, null,
1210: null, false)).booleanValue();
1211: }
1212:
1213: /**
1214: * @see java.sql.DatabaseMetaData#supportsLimitedOuterJoins()
1215: */
1216: public boolean supportsLimitedOuterJoins() throws SQLException {
1217: return ((Boolean) getMetadata(
1218: MetadataDescription.SUPPORTS_LIMITED_OUTER_JOINS, null,
1219: null, false)).booleanValue();
1220: }
1221:
1222: /**
1223: * @see java.sql.DatabaseMetaData#supportsMinimumSQLGrammar()
1224: */
1225: public boolean supportsMinimumSQLGrammar() throws SQLException {
1226: return ((Boolean) getMetadata(
1227: MetadataDescription.SUPPORTS_MINIMUM_SQL_GRAMMAR, null,
1228: null, false)).booleanValue();
1229: }
1230:
1231: /**
1232: * @see java.sql.DatabaseMetaData#supportsMixedCaseIdentifiers()
1233: */
1234: public boolean supportsMixedCaseIdentifiers() throws SQLException {
1235: return ((Boolean) getMetadata(
1236: MetadataDescription.SUPPORTS_MIXED_CASE_IDENTIFIERS,
1237: null, null, false)).booleanValue();
1238: }
1239:
1240: /**
1241: * @see java.sql.DatabaseMetaData#supportsMixedCaseQuotedIdentifiers()
1242: */
1243: public boolean supportsMixedCaseQuotedIdentifiers()
1244: throws SQLException {
1245: return ((Boolean) getMetadata(
1246: MetadataDescription.SUPPORTS_MIXED_CASE_QUOTED_IDENTIFIERS,
1247: null, null, false)).booleanValue();
1248: }
1249:
1250: /**
1251: * @see java.sql.DatabaseMetaData#supportsMultipleResultSets()
1252: */
1253: public boolean supportsMultipleResultSets() throws SQLException {
1254: return ((Boolean) getMetadata(
1255: MetadataDescription.SUPPORTS_MULTIPLE_RESULTSETS, null,
1256: null, false)).booleanValue();
1257: }
1258:
1259: /**
1260: * @see java.sql.DatabaseMetaData#supportsMultipleTransactions()
1261: */
1262: public boolean supportsMultipleTransactions() throws SQLException {
1263: return ((Boolean) getMetadata(
1264: MetadataDescription.SUPPORTS_MULTIPLE_TRANSACTIONS,
1265: null, null, false)).booleanValue();
1266: }
1267:
1268: /**
1269: * @see java.sql.DatabaseMetaData#supportsNonNullableColumns()
1270: */
1271: public boolean supportsNonNullableColumns() throws SQLException {
1272: return ((Boolean) getMetadata(
1273: MetadataDescription.SUPPORTS_NON_NULLABLE_COLUMNS,
1274: null, null, false)).booleanValue();
1275: }
1276:
1277: /**
1278: * @see java.sql.DatabaseMetaData#supportsOpenCursorsAcrossCommit()
1279: */
1280: public boolean supportsOpenCursorsAcrossCommit()
1281: throws SQLException {
1282: return ((Boolean) getMetadata(
1283: MetadataDescription.SUPPORTS_OPEN_CURSORS_ACROSS_COMMIT,
1284: null, null, false)).booleanValue();
1285: }
1286:
1287: /**
1288: * @see java.sql.DatabaseMetaData#supportsOpenCursorsAcrossRollback()
1289: */
1290: public boolean supportsOpenCursorsAcrossRollback()
1291: throws SQLException {
1292: return ((Boolean) getMetadata(
1293: MetadataDescription.SUPPORTS_OPEN_CURSORS_ACROSS_ROLLBACK,
1294: null, null, false)).booleanValue();
1295: }
1296:
1297: /**
1298: * @see java.sql.DatabaseMetaData#supportsOpenStatementsAcrossCommit()
1299: */
1300: public boolean supportsOpenStatementsAcrossCommit()
1301: throws SQLException {
1302: return ((Boolean) getMetadata(
1303: MetadataDescription.SUPPORTS_OPEN_STATEMENTS_ACROSS_COMMIT,
1304: null, null, false)).booleanValue();
1305: }
1306:
1307: /**
1308: * @see java.sql.DatabaseMetaData#supportsOpenStatementsAcrossRollback()
1309: */
1310: public boolean supportsOpenStatementsAcrossRollback()
1311: throws SQLException {
1312: return ((Boolean) getMetadata(
1313: MetadataDescription.SUPPORTS_OPEN_STATEMENTS_ACROSS_ROLLBACK,
1314: null, null, false)).booleanValue();
1315: }
1316:
1317: /**
1318: * @see java.sql.DatabaseMetaData#supportsOrderByUnrelated()
1319: */
1320: public boolean supportsOrderByUnrelated() throws SQLException {
1321: return ((Boolean) getMetadata(
1322: MetadataDescription.SUPPORTS_ORDER_BY_UNRELATED, null,
1323: null, false)).booleanValue();
1324: }
1325:
1326: /**
1327: * @see java.sql.DatabaseMetaData#supportsOuterJoins()
1328: */
1329: public boolean supportsOuterJoins() throws SQLException {
1330: return ((Boolean) getMetadata(
1331: MetadataDescription.SUPPORTS_OUTER_JOINS, null, null,
1332: false)).booleanValue();
1333: }
1334:
1335: /**
1336: * @see java.sql.DatabaseMetaData#supportsPositionedDelete()
1337: */
1338: public boolean supportsPositionedDelete() throws SQLException {
1339: return ((Boolean) getMetadata(
1340: MetadataDescription.SUPPORTS_POSITIONED_DELETE, null,
1341: null, false)).booleanValue();
1342: }
1343:
1344: /**
1345: * @see java.sql.DatabaseMetaData#supportsPositionedUpdate()
1346: */
1347: public boolean supportsPositionedUpdate() throws SQLException {
1348: return ((Boolean) getMetadata(
1349: MetadataDescription.SUPPORTS_POSITIONED_UPDATE, null,
1350: null, false)).booleanValue();
1351: }
1352:
1353: /**
1354: * @see java.sql.DatabaseMetaData#supportsResultSetConcurrency(int, int)
1355: */
1356: public boolean supportsResultSetConcurrency(int type,
1357: int concurrency) throws SQLException {
1358: return ((Boolean) getMetadata(
1359: MetadataDescription.SUPPORTS_RESULT_SET_CONCURRENCY,
1360: new Class[] { Integer.TYPE, Integer.TYPE },
1361: new Object[] { new Integer(type),
1362: new Integer(concurrency) }, false))
1363: .booleanValue();
1364: }
1365:
1366: /**
1367: * @see java.sql.DatabaseMetaData#supportsResultSetHoldability(int)
1368: */
1369: public boolean supportsResultSetHoldability(int holdability)
1370: throws SQLException {
1371: return ((Boolean) getMetadata(
1372: MetadataDescription.SUPPORTS_RESULT_SET_HOLDABILITY,
1373: new Class[] { Integer.TYPE },
1374: new Object[] { new Integer(holdability) }, false))
1375: .booleanValue();
1376: }
1377:
1378: /**
1379: * @see java.sql.DatabaseMetaData#supportsResultSetType(int)
1380: */
1381: public boolean supportsResultSetType(int type) throws SQLException {
1382: return ((Boolean) getMetadata(
1383: MetadataDescription.SUPPORTS_RESULT_SET_TYPE,
1384: new Class[] { Integer.TYPE },
1385: new Object[] { new Integer(type) }, false))
1386: .booleanValue();
1387: }
1388:
1389: /**
1390: * @see java.sql.DatabaseMetaData#supportsSchemasInDataManipulation()
1391: */
1392: public boolean supportsSchemasInDataManipulation()
1393: throws SQLException {
1394: return ((Boolean) getMetadata(
1395: MetadataDescription.SUPPORTS_SCHEMAS_IN_DATA_MANIPULATION,
1396: null, null, false)).booleanValue();
1397: }
1398:
1399: /**
1400: * @see java.sql.DatabaseMetaData#supportsSchemasInIndexDefinitions()
1401: */
1402: public boolean supportsSchemasInIndexDefinitions()
1403: throws SQLException {
1404: return ((Boolean) getMetadata(
1405: MetadataDescription.SUPPORTS_SCHEMAS_IN_INDEX_DEFINITIONS,
1406: null, null, false)).booleanValue();
1407: }
1408:
1409: /**
1410: * @see java.sql.DatabaseMetaData#supportsSchemasInPrivilegeDefinitions()
1411: */
1412: public boolean supportsSchemasInPrivilegeDefinitions()
1413: throws SQLException {
1414: return ((Boolean) getMetadata(
1415: MetadataDescription.SUPPORTS_SCHEMAS_IN_PRIVILEGE_DEFINITIONS,
1416: null, null, false)).booleanValue();
1417: }
1418:
1419: /**
1420: * @see java.sql.DatabaseMetaData#supportsSchemasInProcedureCalls()
1421: */
1422: public boolean supportsSchemasInProcedureCalls()
1423: throws SQLException {
1424: return ((Boolean) getMetadata(
1425: MetadataDescription.SUPPORTS_SCHEMAS_IN_PROCEDURE_CALLS,
1426: null, null, false)).booleanValue();
1427: }
1428:
1429: /**
1430: * @see java.sql.DatabaseMetaData#supportsSchemasInTableDefinitions()
1431: */
1432: public boolean supportsSchemasInTableDefinitions()
1433: throws SQLException {
1434: return ((Boolean) getMetadata(
1435: MetadataDescription.SUPPORTS_SCHEMAS_IN_TABLE_DEFINITIONS,
1436: null, null, false)).booleanValue();
1437: }
1438:
1439: /**
1440: * @see java.sql.DatabaseMetaData#supportsSelectForUpdate()
1441: */
1442: public boolean supportsSelectForUpdate() throws SQLException {
1443: return ((Boolean) getMetadata(
1444: MetadataDescription.SUPPORTS_SELECT_FOR_UPDATE, null,
1445: null, false)).booleanValue();
1446: }
1447:
1448: /**
1449: * @see java.sql.DatabaseMetaData#supportsStoredProcedures()
1450: */
1451: public boolean supportsStoredProcedures() throws SQLException {
1452: return ((Boolean) getMetadata(
1453: MetadataDescription.SUPPORTS_STORED_PROCEDURES, null,
1454: null, false)).booleanValue();
1455: }
1456:
1457: /**
1458: * @see java.sql.DatabaseMetaData#supportsSubqueriesInComparisons()
1459: */
1460: public boolean supportsSubqueriesInComparisons()
1461: throws SQLException {
1462: return ((Boolean) getMetadata(
1463: MetadataDescription.SUPPORTS_SUB_QUERIES_IN_COMPARISONS,
1464: null, null, false)).booleanValue();
1465: }
1466:
1467: /**
1468: * @see java.sql.DatabaseMetaData#supportsSubqueriesInExists()
1469: */
1470: public boolean supportsSubqueriesInExists() throws SQLException {
1471: return ((Boolean) getMetadata(
1472: MetadataDescription.SUPPORTS_SUB_QUERIES_IN_EXISTS,
1473: null, null, false)).booleanValue();
1474: }
1475:
1476: /**
1477: * @see java.sql.DatabaseMetaData#supportsSubqueriesInIns()
1478: */
1479: public boolean supportsSubqueriesInIns() throws SQLException {
1480: return ((Boolean) getMetadata(
1481: MetadataDescription.SUPPORTS_SUB_QUERIES_IN_INS, null,
1482: null, false)).booleanValue();
1483: }
1484:
1485: /**
1486: * @see java.sql.DatabaseMetaData#supportsSubqueriesInQuantifieds()
1487: */
1488: public boolean supportsSubqueriesInQuantifieds()
1489: throws SQLException {
1490: return ((Boolean) getMetadata(
1491: MetadataDescription.SUPPORTS_SUB_QUERIES_IN_QUANTIFIEDS,
1492: null, null, false)).booleanValue();
1493: }
1494:
1495: /**
1496: * @see java.sql.DatabaseMetaData#supportsTableCorrelationNames()
1497: */
1498: public boolean supportsTableCorrelationNames() throws SQLException {
1499: return ((Boolean) getMetadata(
1500: MetadataDescription.SUPPORTS_TABLE_CORRELATION_NAMES,
1501: null, null, false)).booleanValue();
1502: }
1503:
1504: /**
1505: * @see java.sql.DatabaseMetaData#supportsTransactionIsolationLevel(int)
1506: */
1507: public boolean supportsTransactionIsolationLevel(int level)
1508: throws SQLException {
1509: return ((Boolean) getMetadata(
1510: MetadataDescription.SUPPORTS_TRANSACTION_ISOLATION_LEVEL,
1511: new Class[] { Integer.TYPE },
1512: new Object[] { new Integer(level) }, false))
1513: .booleanValue();
1514: }
1515:
1516: /**
1517: * @see java.sql.DatabaseMetaData#supportsTransactions()
1518: */
1519: public boolean supportsTransactions() throws SQLException {
1520: return ((Boolean) getMetadata(
1521: MetadataDescription.SUPPORTS_TRANSACTIONS, null, null,
1522: false)).booleanValue();
1523: }
1524:
1525: /**
1526: * @see java.sql.DatabaseMetaData#supportsUnion()
1527: */
1528: public boolean supportsUnion() throws SQLException {
1529: return ((Boolean) getMetadata(
1530: MetadataDescription.SUPPORTS_UNION, null, null, false))
1531: .booleanValue();
1532: }
1533:
1534: /**
1535: * @see java.sql.DatabaseMetaData#supportsUnionAll()
1536: */
1537: public boolean supportsUnionAll() throws SQLException {
1538: return ((Boolean) getMetadata(
1539: MetadataDescription.SUPPORTS_UNION_ALL, null, null,
1540: false)).booleanValue();
1541: }
1542:
1543: /**
1544: * @see java.sql.DatabaseMetaData#updatesAreDetected(int)
1545: */
1546: public boolean updatesAreDetected(int type) throws SQLException {
1547: return ((Boolean) getMetadata(
1548: MetadataDescription.UPDATES_ARE_DETECTED,
1549: new Class[] { Integer.TYPE },
1550: new Object[] { new Integer(type) }, false))
1551: .booleanValue();
1552: }
1553:
1554: /**
1555: * @see java.sql.DatabaseMetaData#usesLocalFilePerTable()
1556: */
1557: public boolean usesLocalFilePerTable() throws SQLException {
1558: return ((Boolean) getMetadata(
1559: MetadataDescription.USES_LOCAL_FILE_PER_TABLE, null,
1560: null, false)).booleanValue();
1561: }
1562:
1563: /**
1564: * @see java.sql.DatabaseMetaData#usesLocalFiles()
1565: */
1566: public boolean usesLocalFiles() throws SQLException {
1567: return ((Boolean) getMetadata(
1568: MetadataDescription.USES_LOCAL_FILES, null, null, false))
1569: .booleanValue();
1570: }
1571:
1572: // ------------------- JDBC 3.0 -------------------------
1573:
1574: /**
1575: * @see java.sql.DatabaseMetaData#supportsSavepoints()
1576: */
1577: public boolean supportsSavepoints() throws SQLException {
1578: return ((Boolean) getMetadata(
1579: MetadataDescription.SUPPORTS_SAVEPOINTS, null, null,
1580: false)).booleanValue();
1581: }
1582:
1583: /**
1584: * @see java.sql.DatabaseMetaData#supportsNamedParameters()
1585: */
1586: public boolean supportsNamedParameters() throws SQLException {
1587: return ((Boolean) getMetadata(
1588: MetadataDescription.SUPPORTS_NAMED_PARAMETERS, null,
1589: null, false)).booleanValue();
1590: }
1591:
1592: /**
1593: * @see java.sql.DatabaseMetaData#supportsMultipleOpenResults()
1594: */
1595: public boolean supportsMultipleOpenResults() throws SQLException {
1596: return ((Boolean) getMetadata(
1597: MetadataDescription.SUPPORTS_MULTIPLE_OPEN_RESULTS,
1598: null, null, false)).booleanValue();
1599: }
1600:
1601: /**
1602: * @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys()
1603: */
1604: public boolean supportsGetGeneratedKeys() throws SQLException {
1605: return ((Boolean) getMetadata(
1606: MetadataDescription.SUPPORTS_GET_GENERATED_KEYS, null,
1607: null, false)).booleanValue();
1608: }
1609:
1610: /**
1611: * @see java.sql.DatabaseMetaData#getSuperTypes(java.lang.String,
1612: * java.lang.String, java.lang.String)
1613: */
1614: public java.sql.ResultSet getSuperTypes(String catalog,
1615: String schemaPattern, String typeNamePattern)
1616: throws SQLException {
1617: return connection.getSuperTypes(catalog, schemaPattern,
1618: typeNamePattern);
1619: }
1620:
1621: /**
1622: * @see java.sql.DatabaseMetaData#getSuperTables(java.lang.String,
1623: * java.lang.String, java.lang.String)
1624: */
1625: public java.sql.ResultSet getSuperTables(String catalog,
1626: String schemaPattern, String tableNamePattern)
1627: throws SQLException {
1628: return connection.getSuperTables(catalog, schemaPattern,
1629: tableNamePattern);
1630: }
1631:
1632: /**
1633: * @see java.sql.DatabaseMetaData#getAttributes(java.lang.String,
1634: * java.lang.String, java.lang.String, java.lang.String)
1635: */
1636: public java.sql.ResultSet getAttributes(String catalog,
1637: String schemaPattern, String typeNamePattern,
1638: String attributeNamePattern) throws SQLException {
1639: return connection.getAttributes(catalog, schemaPattern,
1640: typeNamePattern, attributeNamePattern);
1641: }
1642:
1643: /**
1644: * @see java.sql.DatabaseMetaData#getResultSetHoldability()
1645: */
1646: public int getResultSetHoldability() throws SQLException {
1647: return ((Integer) getMetadata(
1648: MetadataDescription.GET_RESULTSET_HOLDABILITY, null,
1649: null, false)).intValue();
1650: }
1651:
1652: /**
1653: * @see java.sql.DatabaseMetaData#getDatabaseMajorVersion()
1654: */
1655: public int getDatabaseMajorVersion() throws SQLException {
1656: return ((Integer) getMetadata(
1657: MetadataDescription.GET_DATABASE_MAJOR_VERSION, null,
1658: null, false)).intValue();
1659: }
1660:
1661: /**
1662: * @see java.sql.DatabaseMetaData#getDatabaseMinorVersion()
1663: */
1664: public int getDatabaseMinorVersion() throws SQLException {
1665: return ((Integer) getMetadata(
1666: MetadataDescription.GET_DATABASE_MINOR_VERSION, null,
1667: null, false)).intValue();
1668: }
1669:
1670: /**
1671: * Retrieves the major JDBC version number for this driver.
1672: *
1673: * @return JDBC version major number
1674: * @exception SQLException if a database access error occurs
1675: * @since JDK 1.4
1676: */
1677: public int getJDBCMajorVersion() throws SQLException {
1678: return Driver.MAJOR_VERSION;
1679: }
1680:
1681: /**
1682: * Retrieves the minor JDBC version number for this driver.
1683: *
1684: * @return JDBC version minor number
1685: * @exception SQLException if a database access error occurs
1686: * @since JDK 1.4
1687: */
1688: public int getJDBCMinorVersion() throws SQLException {
1689: return Driver.MINOR_VERSION;
1690: }
1691:
1692: /**
1693: * @see java.sql.DatabaseMetaData#getSQLStateType()
1694: */
1695: public int getSQLStateType() throws SQLException {
1696: return ((Integer) getMetadata(
1697: MetadataDescription.GET_SQL_STATE_TYPE, null, null,
1698: false)).intValue();
1699: }
1700:
1701: /**
1702: * @see java.sql.DatabaseMetaData#locatorsUpdateCopy()
1703: */
1704: public boolean locatorsUpdateCopy() throws SQLException {
1705: return ((Boolean) getMetadata(
1706: MetadataDescription.LOCATORS_UPDATE_COPY, null, null,
1707: false)).booleanValue();
1708: }
1709:
1710: /**
1711: * @see java.sql.DatabaseMetaData#supportsStatementPooling()
1712: */
1713: public boolean supportsStatementPooling() throws SQLException {
1714: return ((Boolean) getMetadata(
1715: MetadataDescription.SUPPORTS_STATEMENT_POOLING, null,
1716: null, false)).booleanValue();
1717: }
1718: }
|