public class RowSetMetaDataImpl extends Object implements RowSetMetaData, Serializable
Provides implementations for the methods that set and get metadata information about a RowSet
object's columns. A RowSetMetaDataImpl
object keeps track of the number of columns in the rowset and maintains an internal array of column attributes for each column.
A RowSet
object creates a RowSetMetaDataImpl
object internally in order to set and retrieve information about its columns.
NOTE: All metadata in a RowSetMetaDataImpl
object should be considered as unavailable until the RowSet
object that it describes is populated. Therefore, any RowSetMetaDataImpl
method that retrieves information is defined as having unspecified behavior when it is called before the RowSet
object contains data.
columnNoNulls, columnNullable, columnNullableUnknown
public RowSetMetaDataImpl()
public void setColumnCount(int columnCount) throws SQLException
Sets to the given number the number of columns in the RowSet
object for which this RowSetMetaDataImpl
object was created.
setColumnCount
in interface RowSetMetaData
columnCount
- an int
giving the number of columns in the RowSet
objectSQLException
- if the given number is equal to or less than zeropublic void setAutoIncrement(int columnIndex, boolean property) throws SQLException
Sets whether the designated column is automatically numbered, thus read-only, to the given boolean
value.
setAutoIncrement
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns in the rowset, inclusiveproperty
- true
if the given column is automatically incremented; false
otherwiseSQLException
- if a database access error occurs or the given index is out of boundspublic void setCaseSensitive(int columnIndex, boolean property) throws SQLException
Sets whether the name of the designated column is case sensitive to the given boolean
.
setCaseSensitive
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns in the rowset, inclusiveproperty
- true
to indicate that the column name is case sensitive; false
otherwiseSQLException
- if a database access error occurs or the given column number is out of boundspublic void setSearchable(int columnIndex, boolean property) throws SQLException
Sets whether a value stored in the designated column can be used in a WHERE
clause to the given boolean
value.
setSearchable
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns in the rowset, inclusiveproperty
- true
to indicate that a column value can be used in a WHERE
clause; false
otherwiseSQLException
- if a database access error occurs or the given column number is out of boundspublic void setCurrency(int columnIndex, boolean property) throws SQLException
Sets whether a value stored in the designated column is a cash value to the given boolean
.
setCurrency
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusive between 1
and the number of columns, inclusiveproperty
- true if the value is a cash value; false otherwise.SQLException
- if a database access error occurs or the given column number is out of boundspublic void setNullable(int columnIndex, int property) throws SQLException
Sets whether a value stored in the designated column can be set to NULL
to the given constant from the interface ResultSetMetaData
.
setNullable
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveproperty
- one of the following ResultSetMetaData
constants: columnNoNulls
, columnNullable
, or columnNullableUnknown
SQLException
- if a database access error occurs, the given column number is out of bounds, or the value supplied for the property parameter is not one of the following constants: ResultSetMetaData.columnNoNulls
, ResultSetMetaData.columnNullable
, or ResultSetMetaData.columnNullableUnknown
public void setSigned(int columnIndex, boolean property) throws SQLException
Sets whether a value stored in the designated column is a signed number to the given boolean
.
setSigned
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveproperty
- true
to indicate that a column value is a signed number; false
to indicate that it is notSQLException
- if a database access error occurs or the given column number is out of boundspublic void setColumnDisplaySize(int columnIndex, int size) throws SQLException
Sets the normal maximum number of chars in the designated column to the given number.
setColumnDisplaySize
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivesize
- the maximum size of the column in chars; must be 0
or moreSQLException
- if a database access error occurs, the given column number is out of bounds, or size is less than 0
public void setColumnLabel(int columnIndex, String label) throws SQLException
Sets the suggested column label for use in printouts and displays, if any, to label. If label is null
, the column label is set to an empty string ("").
setColumnLabel
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivelabel
- the column label to be used in printouts and displays; if the column label is null
, an empty String
is setSQLException
- if a database access error occurs or the given column index is out of boundspublic void setColumnName(int columnIndex, String columnName) throws SQLException
Sets the column name of the designated column to the given name.
setColumnName
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivecolumnName
- a String
object indicating the column name; if the given name is null
, an empty String
is setSQLException
- if a database access error occurs or the given column index is out of boundspublic void setSchemaName(int columnIndex, String schemaName) throws SQLException
Sets the designated column's table's schema name, if any, to schemaName. If schemaName is null
, the schema name is set to an empty string ("").
setSchemaName
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveschemaName
- the schema name for the table from which a value in the designated column was derived; may be an empty String
or null
SQLException
- if a database access error occurs or the given column number is out of boundspublic void setPrecision(int columnIndex, int precision) throws SQLException
Sets the total number of decimal digits in a value stored in the designated column to the given number.
setPrecision
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveprecision
- the total number of decimal digits; must be 0
or moreSQLException
- if a database access error occurs, columnIndex is out of bounds, or precision is less than 0
public void setScale(int columnIndex, int scale) throws SQLException
Sets the number of digits to the right of the decimal point in a value stored in the designated column to the given number.
setScale
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivescale
- the number of digits to the right of the decimal point; must be zero or greaterSQLException
- if a database access error occurs, columnIndex is out of bounds, or scale is less than 0
public void setTableName(int columnIndex, String tableName) throws SQLException
Sets the name of the table from which the designated column was derived to the given table name.
setTableName
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivetableName
- the column's table name; may be null
or an empty stringSQLException
- if a database access error occurs or the given column number is out of boundspublic void setCatalogName(int columnIndex, String catalogName) throws SQLException
Sets the catalog name of the table from which the designated column was derived to catalogName. If catalogName is null
, the catalog name is set to an empty string.
setCatalogName
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivecatalogName
- the column's table's catalog name; if the catalogName is null
, an empty String
is setSQLException
- if a database access error occurs or the given column number is out of boundspublic void setColumnType(int columnIndex, int SQLType) throws SQLException
Sets the SQL type code for values stored in the designated column to the given type code from the class java.sql.Types
.
setColumnType
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveSQLType
- the designated column's SQL type, which must be one of the constants in the class java.sql.Types
SQLException
- if a database access error occurs, the given column number is out of bounds, or the column type specified is not one of the constants in java.sql.Types
Types
public void setColumnTypeName(int columnIndex, String typeName) throws SQLException
Sets the type name used by the data source for values stored in the designated column to the given type name.
setColumnTypeName
in interface RowSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivetypeName
- the data source-specific type name; if typeName is null
, an empty String
is setSQLException
- if a database access error occurs or the given column number is out of boundspublic int getColumnCount() throws SQLException
Retrieves the number of columns in the RowSet
object for which this RowSetMetaDataImpl
object was created.
getColumnCount
in interface ResultSetMetaData
SQLException
- if an error occurs determining the column countpublic boolean isAutoIncrement(int columnIndex) throws SQLException
Retrieves whether a value stored in the designated column is automatically numbered, and thus readonly.
isAutoIncrement
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivetrue
if the column is automatically numbered; false
otherwiseSQLException
- if a database access error occurs or the given column number is out of boundspublic boolean isCaseSensitive(int columnIndex) throws SQLException
Indicates whether the case of the designated column's name matters.
isCaseSensitive
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivetrue
if the column name is case sensitive; false
otherwiseSQLException
- if a database access error occurs or the given column number is out of boundspublic boolean isSearchable(int columnIndex) throws SQLException
Indicates whether a value stored in the designated column can be used in a WHERE
clause.
isSearchable
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivetrue
if a value in the designated column can be used in a WHERE
clause; false
otherwiseSQLException
- if a database access error occurs or the given column number is out of boundspublic boolean isCurrency(int columnIndex) throws SQLException
Indicates whether a value stored in the designated column is a cash value.
isCurrency
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivetrue
if a value in the designated column is a cash value; false
otherwiseSQLException
- if a database access error occurs or the given column number is out of boundspublic int isNullable(int columnIndex) throws SQLException
Retrieves a constant indicating whether it is possible to store a NULL
value in the designated column.
isNullable
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveResultSetMetaData
interface; either columnNoNulls
, columnNullable
, or columnNullableUnknown
SQLException
- if a database access error occurs or the given column number is out of boundspublic boolean isSigned(int columnIndex) throws SQLException
Indicates whether a value stored in the designated column is a signed number.
isSigned
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivetrue
if a value in the designated column is a signed number; false
otherwiseSQLException
- if a database access error occurs or the given column number is out of boundspublic int getColumnDisplaySize(int columnIndex) throws SQLException
Retrieves the normal maximum width in chars of the designated column.
getColumnDisplaySize
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveSQLException
- if a database access error occurs or the given column number is out of boundspublic String getColumnLabel(int columnIndex) throws SQLException
Retrieves the suggested column title for the designated column for use in printouts and displays.
getColumnLabel
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveSQLException
- if a database access error occurs or the given column number is out of boundspublic String getColumnName(int columnIndex) throws SQLException
Retrieves the name of the designated column.
getColumnName
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveSQLException
- if a database access error occurs or the given column number is out of boundspublic String getSchemaName(int columnIndex) throws SQLException
Retrieves the schema name of the table from which the value in the designated column was derived.
getSchemaName
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveString
if no schema name is availableSQLException
- if a database access error occurs or the given column number is out of boundspublic int getPrecision(int columnIndex) throws SQLException
Retrieves the total number of digits for values stored in the designated column.
getPrecision
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveSQLException
- if a database access error occurs or the given column number is out of boundspublic int getScale(int columnIndex) throws SQLException
Retrieves the number of digits to the right of the decimal point for values stored in the designated column.
getScale
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveSQLException
- if a database access error occurs or the given column number is out of boundspublic String getTableName(int columnIndex) throws SQLException
Retrieves the name of the table from which the value in the designated column was derived.
getTableName
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveString
if no table name is availableSQLException
- if a database access error occurs or the given column number is out of boundspublic String getCatalogName(int columnIndex) throws SQLException
Retrieves the catalog name of the table from which the value in the designated column was derived.
getCatalogName
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveString
if no catalog name is availableSQLException
- if a database access error occurs or the given column number is out of boundspublic int getColumnType(int columnIndex) throws SQLException
Retrieves the type code (one of the java.sql.Types
constants) for the SQL type of the value stored in the designated column.
getColumnType
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveint
representing the SQL type of values stored in the designated columnSQLException
- if a database access error occurs or the given column number is out of boundsTypes
public String getColumnTypeName(int columnIndex) throws SQLException
Retrieves the DBMS-specific type name for values stored in the designated column.
getColumnTypeName
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveSQLException
- if a database access error occurs or the given column number is out of boundspublic boolean isReadOnly(int columnIndex) throws SQLException
Indicates whether the designated column is definitely not writable, thus readonly.
isReadOnly
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivetrue
if this RowSet
object is read-Only and thus not updatable; false
otherwiseSQLException
- if a database access error occurs or the given column number is out of boundspublic boolean isWritable(int columnIndex) throws SQLException
Indicates whether it is possible for a write operation on the designated column to succeed. A return value of true
means that a write operation may or may not succeed.
isWritable
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivetrue
if a write operation on the designated column may will succeed; false
otherwiseSQLException
- if a database access error occurs or the given column number is out of boundspublic boolean isDefinitelyWritable(int columnIndex) throws SQLException
Indicates whether a write operation on the designated column will definitely succeed.
isDefinitelyWritable
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusivetrue
if a write operation on the designated column will definitely succeed; false
otherwiseSQLException
- if a database access error occurs or the given column number is out of boundspublic String getColumnClassName(int columnIndex) throws SQLException
Retrieves the fully-qualified name of the class in the Java programming language to which a value in the designated column will be mapped. For example, if the value is an int
, the class name returned by this method will be java.lang.Integer
.
If the value in the designated column has a custom mapping, this method returns the name of the class that implements SQLData
. When the method ResultSet.getObject
is called to retrieve a value from the designated column, it will create an instance of this class or one of its subclasses.
getColumnClassName
in interface ResultSetMetaData
columnIndex
- the first column is 1, the second is 2, and so on; must be between 1
and the number of columns, inclusiveRowSet.getObject
to retrieve the value in the specified column. This is the class name used for custom mapping when there is a custom mapping.SQLException
- if a database access error occurs or the given column number is out of boundspublic <T> T unwrap(Class<T> iface) throws SQLException
Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy. The result may be either the object found to implement the interface or a proxy for that object. If the receiver implements the interface then that is the object. If the receiver is a wrapper and the wrapped object implements the interface then that is the object. Otherwise the object is the result of calling unwrap
recursively on the wrapped object. If the receiver is not a wrapper and does not implement the interface, then an SQLException
is thrown.
unwrap
in interface Wrapper
T
- the type of the class modeled by this Class objectiface
- A Class defining an interface that the result must implement.SQLException
- If no object found that implements the interfacepublic boolean isWrapperFor(Class<?> interfaces) throws SQLException
Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does. Returns false otherwise. If this implements the interface then return true, else if this is a wrapper then return the result of recursively calling isWrapperFor
on the wrapped object. If this does not implement the interface and is not a wrapper, return false. This method should be implemented as a low-cost operation compared to unwrap
so that callers can use this method to avoid expensive unwrap
calls that may fail. If this method returns true then calling unwrap
with the same argument should succeed.
isWrapperFor
in interface Wrapper
interfaces
- a Class defining an interface.SQLException
- if an error occurs while determining whether this is a wrapper for an object with the given interface.
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.