| Java™ Platform Standard Ed. 6 | ||||||||||
public interfaceResultSetMetaData
An object that can be used to get information about the types and properties of the columns in aResultSet object. The following code fragment creates theResultSet object rs, creates theResultSetMetaData object rsmd, and uses rsmd to find out how many columns rs has and whether the first column in rs can be used in aWHERE clause.
ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2"); ResultSetMetaData rsmd = rs.getMetaData(); int numberOfColumns = rsmd.getColumnCount(); boolean b = rsmd.isSearchable(1);columnNoNullsThe constant indicating that a column does not allow NULL values. | |
columnNullableThe constant indicating that a column allows NULL values. | |
columnNullableUnknownThe constant indicating that the nullability of a column's values is unknown. | |
getCatalogName(int column)Gets the designated column's table's catalog name. | |
getColumnClassName(int column)Returns the fully-qualified name of the Java class whose instances are manufactured if the method ResultSet.getObject is called to retrieve a value from the column. | |
getColumnCount()Returns the number of columns in this ResultSet object. | |
getColumnDisplaySize(int column)Indicates the designated column's normal maximum width in characters. | |
getColumnLabel(int column)Gets the designated column's suggested title for use in printouts and displays. | |
getColumnName(int column)Get the designated column's name. | |
getColumnType(int column)Retrieves the designated column's SQL type. | |
getColumnTypeName(int column)Retrieves the designated column's database-specific type name. | |
getPrecision(int column)Get the designated column's specified column size. | |
getScale(int column)Gets the designated column's number of digits to right of the decimal point. | |
getSchemaName(int column)Get the designated column's table's schema. | |
getTableName(int column)Gets the designated column's table name. | |
isAutoIncrement(int column)Indicates whether the designated column is automatically numbered. | |
isCaseSensitive(int column)Indicates whether a column's case matters. | |
isCurrency(int column)Indicates whether the designated column is a cash value. | |
isDefinitelyWritable(int column)Indicates whether a write on the designated column will definitely succeed. | |
isNullable(int column)Indicates the nullability of values in the designated column. | |
isReadOnly(int column)Indicates whether the designated column is definitely not writable. | |
isSearchable(int column)Indicates whether the designated column can be used in a where clause. | |
isSigned(int column)Indicates whether values in the designated column are signed numbers. | |
isWritable(int column)Indicates whether it is possible for a write on the designated column to succeed. | |
| Methods inherited from interface java.sql.Wrapper |
|---|
isWrapperFor,unwrap |
static final intcolumnNoNulls
NULL values.static final intcolumnNullable
NULL values.static final intcolumnNullableUnknown
intgetColumnCount() throwsSQLException
ResultSet object.SQLException - if a database access error occursbooleanisAutoIncrement(int column) throwsSQLException
column - the first column is 1, the second is 2, ...true if so;false otherwiseSQLException - if a database access error occursbooleanisCaseSensitive(int column) throwsSQLException
column - the first column is 1, the second is 2, ...true if so;false otherwiseSQLException - if a database access error occursbooleanisSearchable(int column) throwsSQLException
column - the first column is 1, the second is 2, ...true if so;false otherwiseSQLException - if a database access error occursbooleanisCurrency(int column) throwsSQLException
column - the first column is 1, the second is 2, ...true if so;false otherwiseSQLException - if a database access error occursintisNullable(int column) throwsSQLException
column - the first column is 1, the second is 2, ...columnNoNulls,columnNullable orcolumnNullableUnknownSQLException - if a database access error occursbooleanisSigned(int column) throwsSQLException
column - the first column is 1, the second is 2, ...true if so;false otherwiseSQLException - if a database access error occursintgetColumnDisplaySize(int column) throwsSQLException
column - the first column is 1, the second is 2, ...SQLException - if a database access error occursStringgetColumnLabel(int column) throwsSQLException
AS clause. If a SQLAS is not specified, the value returned fromgetColumnLabel will be the same as the value returned by thegetColumnName method.column - the first column is 1, the second is 2, ...SQLException - if a database access error occursStringgetColumnName(int column) throwsSQLException
column - the first column is 1, the second is 2, ...SQLException - if a database access error occursStringgetSchemaName(int column) throwsSQLException
column - the first column is 1, the second is 2, ...SQLException - if a database access error occursintgetPrecision(int column) throwsSQLException
column - the first column is 1, the second is 2, ...SQLException - if a database access error occursintgetScale(int column) throwsSQLException
column - the first column is 1, the second is 2, ...SQLException - if a database access error occursStringgetTableName(int column) throwsSQLException
column - the first column is 1, the second is 2, ...SQLException - if a database access error occursStringgetCatalogName(int column) throwsSQLException
column - the first column is 1, the second is 2, ...SQLException - if a database access error occursintgetColumnType(int column) throwsSQLException
column - the first column is 1, the second is 2, ...SQLException - if a database access error occursTypesStringgetColumnTypeName(int column) throwsSQLException
column - the first column is 1, the second is 2, ...SQLException - if a database access error occursbooleanisReadOnly(int column) throwsSQLException
column - the first column is 1, the second is 2, ...true if so;false otherwiseSQLException - if a database access error occursbooleanisWritable(int column) throwsSQLException
column - the first column is 1, the second is 2, ...true if so;false otherwiseSQLException - if a database access error occursbooleanisDefinitelyWritable(int column) throwsSQLException
column - the first column is 1, the second is 2, ...true if so;false otherwiseSQLException - if a database access error occursStringgetColumnClassName(int column) throwsSQLException
Returns the fully-qualified name of the Java class whose instances are manufactured if the methodResultSet.getObject is called to retrieve a value from the column.ResultSet.getObject may return a subclass of the class returned by this method.
column - the first column is 1, the second is 2, ...ResultSet.getObject to retrieve the value in the specified column. This is the class name used for custom mapping.SQLException - if a database access error occurs| Java™ Platform Standard Ed. 6 | ||||||||||