jdk/src/share/classes/java/sql/DatabaseMetaData.java
changeset 6540 a4ae668f6125
parent 5506 202f599c92aa
child 6541 a40c440705b3
equal deleted inserted replaced
6539:874f52171965 6540:a4ae668f6125
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
  1340      *ordinal position of the column in the result set starting from 1.  If there are
  1340      *ordinal position of the column in the result set starting from 1.  If there are
  1341      *multiple result sets, the column ordinal positions are implementation
  1341      *multiple result sets, the column ordinal positions are implementation
  1342      * defined.
  1342      * defined.
  1343      *  <LI><B>IS_NULLABLE</B> String  => ISO rules are used to determine the nullability for a column.
  1343      *  <LI><B>IS_NULLABLE</B> String  => ISO rules are used to determine the nullability for a column.
  1344      *       <UL>
  1344      *       <UL>
  1345      *       <LI> YES           --- if the parameter can include NULLs
  1345      *       <LI> YES           --- if the column can include NULLs
  1346      *       <LI> NO            --- if the parameter cannot include NULLs
  1346      *       <LI> NO            --- if the column cannot include NULLs
  1347      *       <LI> empty string  --- if the nullability for the
  1347      *       <LI> empty string  --- if the nullability for the
  1348      * parameter is unknown
  1348      * column is unknown
  1349      *       </UL>
  1349      *       </UL>
  1350      *  <LI><B>SPECIFIC_NAME</B> String  => the name which uniquely identifies this procedure within its schema.
  1350      *  <LI><B>SPECIFIC_NAME</B> String  => the name which uniquely identifies this procedure within its schema.
  1351      *  </OL>
  1351      *  </OL>
  1352      *
  1352      *
  1353      * <P><B>Note:</B> Some databases may not return the column
  1353      * <P><B>Note:</B> Some databases may not return the column
  1608      *       maximum number of bytes in the column
  1608      *       maximum number of bytes in the column
  1609      *  <LI><B>ORDINAL_POSITION</B> int => index of column in table
  1609      *  <LI><B>ORDINAL_POSITION</B> int => index of column in table
  1610      *      (starting at 1)
  1610      *      (starting at 1)
  1611      *  <LI><B>IS_NULLABLE</B> String  => ISO rules are used to determine the nullability for a column.
  1611      *  <LI><B>IS_NULLABLE</B> String  => ISO rules are used to determine the nullability for a column.
  1612      *       <UL>
  1612      *       <UL>
  1613      *       <LI> YES           --- if the parameter can include NULLs
  1613      *       <LI> YES           --- if the column can include NULLs
  1614      *       <LI> NO            --- if the parameter cannot include NULLs
  1614      *       <LI> NO            --- if the column cannot include NULLs
  1615      *       <LI> empty string  --- if the nullability for the
  1615      *       <LI> empty string  --- if the nullability for the
  1616      * parameter is unknown
  1616      * column is unknown
  1617      *       </UL>
  1617      *       </UL>
  1618      *  <LI><B>SCOPE_CATLOG</B> String => catalog of table that is the scope
  1618      *  <LI><B>SCOPE_CATALOG</B> String => catalog of table that is the scope
  1619      *      of a reference attribute (<code>null</code> if DATA_TYPE isn't REF)
  1619      *      of a reference attribute (<code>null</code> if DATA_TYPE isn't REF)
  1620      *  <LI><B>SCOPE_SCHEMA</B> String => schema of table that is the scope
  1620      *  <LI><B>SCOPE_SCHEMA</B> String => schema of table that is the scope
  1621      *      of a reference attribute (<code>null</code> if the DATA_TYPE isn't REF)
  1621      *      of a reference attribute (<code>null</code> if the DATA_TYPE isn't REF)
  1622      *  <LI><B>SCOPE_TABLE</B> String => table name that this the scope
  1622      *  <LI><B>SCOPE_TABLE</B> String => table name that this the scope
  1623      *      of a reference attribure (<code>null</code> if the DATA_TYPE isn't REF)
  1623      *      of a reference attribute (<code>null</code> if the DATA_TYPE isn't REF)
  1624      *  <LI><B>SOURCE_DATA_TYPE</B> short => source type of a distinct type or user-generated
  1624      *  <LI><B>SOURCE_DATA_TYPE</B> short => source type of a distinct type or user-generated
  1625      *      Ref type, SQL type from java.sql.Types (<code>null</code> if DATA_TYPE
  1625      *      Ref type, SQL type from java.sql.Types (<code>null</code> if DATA_TYPE
  1626      *      isn't DISTINCT or user-generated REF)
  1626      *      isn't DISTINCT or user-generated REF)
  1627      *   <LI><B>IS_AUTOINCREMENT</B> String  => Indicates whether this column is auto incremented
  1627      *   <LI><B>IS_AUTOINCREMENT</B> String  => Indicates whether this column is auto incremented
  1628      *       <UL>
  1628      *       <UL>
  1629      *       <LI> YES           --- if the column is auto incremented
  1629      *       <LI> YES           --- if the column is auto incremented
  1630      *       <LI> NO            --- if the column is not auto incremented
  1630      *       <LI> NO            --- if the column is not auto incremented
  1631      *       <LI> empty string  --- if it cannot be determined whether the column is auto incremented
  1631      *       <LI> empty string  --- if it cannot be determined whether the column is auto incremented
  1632      * parameter is unknown
  1632      *       </UL>
       
  1633      *   <LI><B>IS_GENERATEDCOLUMN</B> String  => Indicates whether this is a generated column
       
  1634      *       <UL>
       
  1635      *       <LI> YES           --- if this a generated column
       
  1636      *       <LI> NO            --- if this not a generated column
       
  1637      *       <LI> empty string  --- if it cannot be determined whether this is a generated column
  1633      *       </UL>
  1638      *       </UL>
  1634      *  </OL>
  1639      *  </OL>
  1635      *
  1640      *
  1636      * <p>The COLUMN_SIZE column the specified column size for the given column.
  1641      * <p>The COLUMN_SIZE column specifies the column size for the given column.
  1637      * For numeric data, this is the maximum precision.  For character data, this is the length in characters.
  1642      * For numeric data, this is the maximum precision.  For character data, this is the length in characters.
  1638      * For datetime datatypes, this is the length in characters of the String representation (assuming the
  1643      * For datetime datatypes, this is the length in characters of the String representation (assuming the
  1639      * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes.  For the ROWID datatype,
  1644      * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes.  For the ROWID datatype,
  1640      * this is the length in bytes. Null is returned for data types where the
  1645      * this is the length in bytes. Null is returned for data types where the
  1641      * column size is not applicable.
  1646      * column size is not applicable.
  3184 
  3189 
  3185     /**
  3190     /**
  3186      * Retrieves whether this database supports statement pooling.
  3191      * Retrieves whether this database supports statement pooling.
  3187      *
  3192      *
  3188      * @return <code>true</code> if so; <code>false</code> otherwise
  3193      * @return <code>true</code> if so; <code>false</code> otherwise
  3189      * @throws SQLExcpetion if a database access error occurs
  3194      * @throws SQLException if a database access error occurs
  3190      * @since 1.4
  3195      * @since 1.4
  3191      */
  3196      */
  3192     boolean supportsStatementPooling() throws SQLException;
  3197     boolean supportsStatementPooling() throws SQLException;
  3193 
  3198 
  3194     //------------------------- JDBC 4.0 -----------------------------------
  3199     //------------------------- JDBC 4.0 -----------------------------------
  3566      * <code>getFunctions</code>.
  3571      * <code>getFunctions</code>.
  3567      * @since 1.6
  3572      * @since 1.6
  3568      */
  3573      */
  3569     int functionReturnsTable    = 2;
  3574     int functionReturnsTable    = 2;
  3570 
  3575 
       
  3576     //--------------------------JDBC 4.1 -----------------------------
       
  3577 
       
  3578     /**
       
  3579      * Retrieves a description of the pseudo or hidden columns available
       
  3580      * in a given table within the specified catalog and schema.
       
  3581      * Psuedo or hidden columns may not always be stored within
       
  3582      * a table and are not visible in a ResultSet unless they are
       
  3583      * specified in the query's outermost SELECT list. Psuedo or hidden
       
  3584      * columns may not necessarily be able to be modified. If there are
       
  3585      * no pseudo or hidden columns, an empty ResultSet is returned.
       
  3586      *
       
  3587      * <P>Only column descriptions matching the catalog, schema, table
       
  3588      * and column name criteria are returned.  They are ordered by
       
  3589      * <code>TABLE_CAT</code>,<code>TABLE_SCHEM</code>, <code>TABLE_NAME</code>
       
  3590      * and <code>COLUMN_NAME</code>.
       
  3591      *
       
  3592      * <P>Each column description has the following columns:
       
  3593      *  <OL>
       
  3594      *  <LI><B>TABLE_CAT</B> String => table catalog (may be <code>null</code>)
       
  3595      *  <LI><B>TABLE_SCHEM</B> String => table schema (may be <code>null</code>)
       
  3596      *  <LI><B>TABLE_NAME</B> String => table name
       
  3597      *  <LI><B>COLUMN_NAME</B> String => column name
       
  3598      *  <LI><B>DATA_TYPE</B> int => SQL type from java.sql.Types
       
  3599      *  <LI><B>COLUMN_SIZE</B> int => column size.
       
  3600      *  <LI><B>DECIMAL_DIGITS</B> int => the number of fractional digits. Null is returned for data types where
       
  3601      * DECIMAL_DIGITS is not applicable.
       
  3602      *  <LI><B>NUM_PREC_RADIX</B> int => Radix (typically either 10 or 2)
       
  3603      *  <LI><B>COLUMN_USAGE</B> String => The allowed usage for the column.  The
       
  3604      *  value returned will correspond to the enum name returned by {@link PseudoColumnUsage#name PseudoColumnUsage.name()}
       
  3605      *  <LI><B>REMARKS</B> String => comment describing column (may be <code>null</code>)
       
  3606      *  <LI><B>CHAR_OCTET_LENGTH</B> int => for char types the
       
  3607      *       maximum number of bytes in the column
       
  3608      *  <LI><B>IS_NULLABLE</B> String  => ISO rules are used to determine the nullability for a column.
       
  3609      *       <UL>
       
  3610      *       <LI> YES           --- if the column can include NULLs
       
  3611      *       <LI> NO            --- if the column cannot include NULLs
       
  3612      *       <LI> empty string  --- if the nullability for the column is unknown
       
  3613      *       </UL>
       
  3614      *  </OL>
       
  3615      *
       
  3616      * <p>The COLUMN_SIZE column specifies the column size for the given column.
       
  3617      * For numeric data, this is the maximum precision.  For character data, this is the length in characters.
       
  3618      * For datetime datatypes, this is the length in characters of the String representation (assuming the
       
  3619      * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes.  For the ROWID datatype,
       
  3620      * this is the length in bytes. Null is returned for data types where the
       
  3621      * column size is not applicable.
       
  3622      *
       
  3623      * @param catalog a catalog name; must match the catalog name as it
       
  3624      *        is stored in the database; "" retrieves those without a catalog;
       
  3625      *        <code>null</code> means that the catalog name should not be used to narrow
       
  3626      *        the search
       
  3627      * @param schemaPattern a schema name pattern; must match the schema name
       
  3628      *        as it is stored in the database; "" retrieves those without a schema;
       
  3629      *        <code>null</code> means that the schema name should not be used to narrow
       
  3630      *        the search
       
  3631      * @param tableNamePattern a table name pattern; must match the
       
  3632      *        table name as it is stored in the database
       
  3633      * @param columnNamePattern a column name pattern; must match the column
       
  3634      *        name as it is stored in the database
       
  3635      * @return <code>ResultSet</code> - each row is a column description
       
  3636      * @exception SQLException if a database access error occurs
       
  3637      * @see PseudoColumnUsage
       
  3638      * @since 1.7
       
  3639      */
       
  3640     ResultSet getPseudoColumns(String catalog, String schemaPattern,
       
  3641                          String tableNamePattern, String columnNamePattern)
       
  3642         throws SQLException;
       
  3643 
       
  3644     /**
       
  3645      * Retrieves whether a generated key will always be returned if the column
       
  3646      * name(s) or indexe(s) specified for the auto generated key column(s)
       
  3647      * are valid and the statement succeeds.  The key that is returned may or
       
  3648      * may not be based on the column(s) for the auto generated key.
       
  3649      * Consult your JDBC driver documentation for additional details.
       
  3650      * @return <code>true</code> if so; <code>false</code> otherwise
       
  3651      * @exception SQLException if a database access error occurs
       
  3652      * @since 1.7
       
  3653      */
       
  3654     boolean  generatedKeyAlwaysReturned() throws SQLException;
  3571 }
  3655 }