001: /*-------------------------------------------------------------------------
002: *
003: * Copyright (c) 2004-2005, PostgreSQL Global Development Group
004: *
005: * IDENTIFICATION
006: * $PostgreSQL: pgjdbc/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java,v 1.11 2005/02/15 08:56:26 jurka Exp $
007: *
008: *-------------------------------------------------------------------------
009: */
010: package org.postgresql.jdbc3;
011:
012: import java.sql.*;
013:
014: public abstract class AbstractJdbc3DatabaseMetaData extends
015: org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData {
016:
017: public AbstractJdbc3DatabaseMetaData(AbstractJdbc3Connection conn) {
018: super (conn);
019: }
020:
021: /**
022: * Retrieves whether this database supports savepoints.
023: *
024: * @return <code>true</code> if savepoints are supported;
025: * <code>false</code> otherwise
026: * @exception SQLException if a database access error occurs
027: * @since 1.4
028: */
029: public boolean supportsSavepoints() throws SQLException {
030: return connection.haveMinimumServerVersion("8.0");
031: }
032:
033: /**
034: * Retrieves whether this database supports named parameters to callable
035: * statements.
036: *
037: * @return <code>true</code> if named parameters are supported;
038: * <code>false</code> otherwise
039: * @exception SQLException if a database access error occurs
040: * @since 1.4
041: */
042: public boolean supportsNamedParameters() throws SQLException {
043: return false;
044: }
045:
046: /**
047: * Retrieves whether it is possible to have multiple <code>ResultSet</code> objects
048: * returned from a <code>CallableStatement</code> object
049: * simultaneously.
050: *
051: * @return <code>true</code> if a <code>CallableStatement</code> object
052: * can return multiple <code>ResultSet</code> objects
053: * simultaneously; <code>false</code> otherwise
054: * @exception SQLException if a datanase access error occurs
055: * @since 1.4
056: */
057: public boolean supportsMultipleOpenResults() throws SQLException {
058: return false;
059: }
060:
061: /**
062: * Retrieves whether auto-generated keys can be retrieved after
063: * a statement has been executed.
064: *
065: * @return <code>true</code> if auto-generated keys can be retrieved
066: * after a statement has executed; <code>false</code> otherwise
067: * @exception SQLException if a database access error occurs
068: * @since 1.4
069: */
070: public boolean supportsGetGeneratedKeys() throws SQLException {
071: return false;
072: }
073:
074: /**
075: * Retrieves a description of the user-defined type (UDT) hierarchies defined in a
076: * particular schema in this database. Only the immediate super type/
077: * sub type relationship is modeled.
078: * <P>
079: * Only supertype information for UDTs matching the catalog,
080: * schema, and type name is returned. The type name parameter
081: * may be a fully-qualified name. When the UDT name supplied is a
082: * fully-qualified name, the catalog and schemaPattern parameters are
083: * ignored.
084: * <P>
085: * If a UDT does not have a direct super type, it is not listed here.
086: * A row of the <code>ResultSet</code> object returned by this method
087: * describes the designated UDT and a direct supertype. A row has the following
088: * columns:
089: * <OL>
090: * <LI><B>TYPE_CAT</B> String => the UDT's catalog (may be <code>null</code>)
091: * <LI><B>TYPE_SCHEM</B> String => UDT's schema (may be <code>null</code>)
092: * <LI><B>TYPE_NAME</B> String => type name of the UDT
093: * <LI><B>SUPERTYPE_CAT</B> String => the direct super type's catalog
094: * (may be <code>null</code>)
095: * <LI><B>SUPERTYPE_SCHEM</B> String => the direct super type's schema
096: * (may be <code>null</code>)
097: * <LI><B>SUPERTYPE_NAME</B> String => the direct super type's name
098: * </OL>
099: *
100: * <P><B>Note:</B> If the driver does not support type hierarchies, an
101: * empty result set is returned.
102: *
103: * @param catalog a catalog name; "" retrieves those without a catalog;
104: * <code>null</code> means drop catalog name from the selection criteria
105: * @param schemaPattern a schema name pattern; "" retrieves those
106: * without a schema
107: * @param typeNamePattern a UDT name pattern; may be a fully-qualified
108: * name
109: * @return a <code>ResultSet</code> object in which a row gives information
110: * about the designated UDT
111: * @throws SQLException if a database access error occurs
112: * @since 1.4
113: */
114: public ResultSet getSuperTypes(String catalog,
115: String schemaPattern, String typeNamePattern)
116: throws SQLException {
117: throw org.postgresql.Driver.notImplemented(this .getClass(),
118: "getSuperTypes(String,String,String)");
119: }
120:
121: /**
122: * Retrieves a description of the table hierarchies defined in a particular
123: * schema in this database.
124: *
125: * <P>Only supertable information for tables matching the catalog, schema
126: * and table name are returned. The table name parameter may be a fully-
127: * qualified name, in which case, the catalog and schemaPattern parameters
128: * are ignored. If a table does not have a super table, it is not listed here.
129: * Supertables have to be defined in the same catalog and schema as the
130: * sub tables. Therefore, the type description does not need to include
131: * this information for the supertable.
132: *
133: * <P>Each type description has the following columns:
134: * <OL>
135: * <LI><B>TABLE_CAT</B> String => the type's catalog (may be <code>null</code>)
136: * <LI><B>TABLE_SCHEM</B> String => type's schema (may be <code>null</code>)
137: * <LI><B>TABLE_NAME</B> String => type name
138: * <LI><B>SUPERTABLE_NAME</B> String => the direct super type's name
139: * </OL>
140: *
141: * <P><B>Note:</B> If the driver does not support type hierarchies, an
142: * empty result set is returned.
143: *
144: * @param catalog a catalog name; "" retrieves those without a catalog;
145: * <code>null</code> means drop catalog name from the selection criteria
146: * @param schemaPattern a schema name pattern; "" retrieves those
147: * without a schema
148: * @param tableNamePattern a table name pattern; may be a fully-qualified
149: * name
150: * @return a <code>ResultSet</code> object in which each row is a type description
151: * @throws SQLException if a database access error occurs
152: * @since 1.4
153: */
154: public ResultSet getSuperTables(String catalog,
155: String schemaPattern, String tableNamePattern)
156: throws SQLException {
157: throw org.postgresql.Driver.notImplemented(this .getClass(),
158: "getSuperTables(String,String,String,String)");
159: }
160:
161: /**
162: * Retrieves a description of the given attribute of the given type
163: * for a user-defined type (UDT) that is available in the given schema
164: * and catalog.
165: * <P>
166: * Descriptions are returned only for attributes of UDTs matching the
167: * catalog, schema, type, and attribute name criteria. They are ordered by
168: * TYPE_SCHEM, TYPE_NAME and ORDINAL_POSITION. This description
169: * does not contain inherited attributes.
170: * <P>
171: * The <code>ResultSet</code> object that is returned has the following
172: * columns:
173: * <OL>
174: * <LI><B>TYPE_CAT</B> String => type catalog (may be <code>null</code>)
175: * <LI><B>TYPE_SCHEM</B> String => type schema (may be <code>null</code>)
176: * <LI><B>TYPE_NAME</B> String => type name
177: * <LI><B>ATTR_NAME</B> String => attribute name
178: * <LI><B>DATA_TYPE</B> short => attribute type SQL type from java.sql.Types
179: * <LI><B>ATTR_TYPE_NAME</B> String => Data source dependent type name.
180: * For a UDT, the type name is fully qualified. For a REF, the type name is
181: * fully qualified and represents the target type of the reference type.
182: * <LI><B>ATTR_SIZE</B> int => column size. For char or date
183: * types this is the maximum number of characters; for numeric or
184: * decimal types this is precision.
185: * <LI><B>DECIMAL_DIGITS</B> int => the number of fractional digits
186: * <LI><B>NUM_PREC_RADIX</B> int => Radix (typically either 10 or 2)
187: * <LI><B>NULLABLE</B> int => whether NULL is allowed
188: * <UL>
189: * <LI> attributeNoNulls - might not allow NULL values
190: * <LI> attributeNullable - definitely allows NULL values
191: * <LI> attributeNullableUnknown - nullability unknown
192: * </UL>
193: * <LI><B>REMARKS</B> String => comment describing column (may be <code>null</code>)
194: * <LI><B>ATTR_DEF</B> String => default value (may be <code>null</code>)
195: * <LI><B>SQL_DATA_TYPE</B> int => unused
196: * <LI><B>SQL_DATETIME_SUB</B> int => unused
197: * <LI><B>CHAR_OCTET_LENGTH</B> int => for char types the
198: * maximum number of bytes in the column
199: * <LI><B>ORDINAL_POSITION</B> int => index of column in table
200: * (starting at 1)
201: * <LI><B>IS_NULLABLE</B> String => "NO" means column definitely
202: * does not allow NULL values; "YES" means the column might
203: * allow NULL values. An empty string means unknown.
204: * <LI><B>SCOPE_CATALOG</B> String => catalog of table that is the
205: * scope of a reference attribute (<code>null</code> if DATA_TYPE isn't REF)
206: * <LI><B>SCOPE_SCHEMA</B> String => schema of table that is the
207: * scope of a reference attribute (<code>null</code> if DATA_TYPE isn't REF)
208: * <LI><B>SCOPE_TABLE</B> String => table name that is the scope of a
209: * reference attribute (<code>null</code> if the DATA_TYPE isn't REF)
210: * <LI><B>SOURCE_DATA_TYPE</B> short => source type of a distinct type or user-generated
211: * Ref type,SQL type from java.sql.Types (<code>null</code> if DATA_TYPE
212: * isn't DISTINCT or user-generated REF)
213: * </OL>
214: * @param catalog a catalog name; must match the catalog name as it
215: * is stored in the database; "" retrieves those without a catalog;
216: * <code>null</code> means that the catalog name should not be used to narrow
217: * the search
218: * @param schemaPattern a schema name pattern; must match the schema name
219: * as it is stored in the database; "" retrieves those without a schema;
220: * <code>null</code> means that the schema name should not be used to narrow
221: * the search
222: * @param typeNamePattern a type name pattern; must match the
223: * type name as it is stored in the database
224: * @param attributeNamePattern an attribute name pattern; must match the attribute
225: * name as it is declared in the database
226: * @return a <code>ResultSet</code> object in which each row is an
227: * attribute description
228: * @exception SQLException if a database access error occurs
229: * @since 1.4
230: */
231: public ResultSet getAttributes(String catalog,
232: String schemaPattern, String typeNamePattern,
233: String attributeNamePattern) throws SQLException {
234: throw org.postgresql.Driver.notImplemented(this .getClass(),
235: "getAttributes(String,String,String,String)");
236: }
237:
238: /**
239: * Retrieves whether this database supports the given result set holdability.
240: *
241: * @param holdability one of the following constants:
242: * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
243: * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT<code>
244: * @return <code>true</code> if so; <code>false</code> otherwise
245: * @exception SQLException if a database access error occurs
246: * @see Connection
247: * @since 1.4
248: */
249: public boolean supportsResultSetHoldability(int holdability)
250: throws SQLException {
251: return true;
252: }
253:
254: /**
255: * Retrieves the default holdability of this <code>ResultSet</code>
256: * object.
257: *
258: * @return the default holdability; either
259: * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
260: * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
261: * @exception SQLException if a database access error occurs
262: * @since 1.4
263: */
264: public int getResultSetHoldability() throws SQLException {
265: return ResultSet.HOLD_CURSORS_OVER_COMMIT;
266: }
267:
268: /**
269: * Retrieves the major version number of the underlying database.
270: *
271: * @return the underlying database's major version
272: * @exception SQLException if a database access error occurs
273: * @since 1.4
274: */
275: public int getDatabaseMajorVersion() throws SQLException {
276: return connection.getServerMajorVersion();
277: }
278:
279: /**
280: * Retrieves the minor version number of the underlying database.
281: *
282: * @return underlying database's minor version
283: * @exception SQLException if a database access error occurs
284: * @since 1.4
285: */
286: public int getDatabaseMinorVersion() throws SQLException {
287: return connection.getServerMinorVersion();
288: }
289:
290: /**
291: * Retrieves the major JDBC version number for this
292: * driver.
293: *
294: * @return JDBC version major number
295: * @exception SQLException if a database access error occurs
296: * @since 1.4
297: */
298: public int getJDBCMajorVersion() throws SQLException {
299: return 3; // This class implements JDBC 3.0
300: }
301:
302: /**
303: * Retrieves the minor JDBC version number for this
304: * driver.
305: *
306: * @return JDBC version minor number
307: * @exception SQLException if a database access error occurs
308: * @since 1.4
309: */
310: public int getJDBCMinorVersion() throws SQLException {
311: return 0; // This class implements JDBC 3.0
312: }
313:
314: /**
315: * Indicates whether the SQLSTATEs returned by <code>SQLException.getSQLState</code>
316: * is X/Open (now known as Open Group) SQL CLI or SQL99.
317: * @return the type of SQLSTATEs, one of:
318: * sqlStateXOpen or
319: * sqlStateSQL99
320: * @throws SQLException if a database access error occurs
321: * @since 1.4
322: */
323: public int getSQLStateType() throws SQLException {
324: return DatabaseMetaData.sqlStateSQL99;
325: }
326:
327: /**
328: * Indicates whether updates made to a LOB are made on a copy or directly
329: * to the LOB.
330: * @return <code>true</code> if updates are made to a copy of the LOB;
331: * <code>false</code> if updates are made directly to the LOB
332: * @throws SQLException if a database access error occurs
333: * @since 1.4
334: */
335: public boolean locatorsUpdateCopy() throws SQLException {
336: /*
337: * Currently LOB's aren't updateable at all, so it doesn't
338: * matter what we return. We don't throw the notImplemented
339: * Exception because the 1.5 JDK's CachedRowSet calls this
340: * method regardless of wether large objects are used.
341: */
342: return true;
343: }
344:
345: /**
346: * Retrieves weather this database supports statement pooling.
347: *
348: * @return <code>true</code> is so;
349: <code>false</code> otherwise
350: * @throws SQLExcpetion if a database access error occurs
351: * @since 1.4
352: */
353: public boolean supportsStatementPooling() throws SQLException {
354: return false;
355: }
356:
357: }
|