Class RowSetMetaDataImpl
- All Implemented Interfaces:
-
Serializable
,ResultSetMetaData
,Wrapper
,RowSetMetaData
public class RowSetMetaDataImpl extends Object implements RowSetMetaData, Serializable
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.
- Since:
- 1.5
- See Also:
Field Summary
Fields declared in interface java.sql.ResultSetMetaData
columnNoNulls, columnNullable, columnNullableUnknown
Constructor Summary
Constructor | Description |
---|---|
RowSetMetaDataImpl() |
Constructs a RowSetMetaDataImpl object. |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
String |
getCatalogName |
Retrieves the catalog name of the table from which the value in the designated column was derived. |
String |
getColumnClassName |
Retrieves the fully-qualified name of the class in the Java programming language to which a value in the designated column will be mapped. |
int |
getColumnCount() |
Retrieves the number of columns in the RowSet object for which this RowSetMetaDataImpl object was created. |
int |
getColumnDisplaySize |
Retrieves the normal maximum width in chars of the designated column. |
String |
getColumnLabel |
Retrieves the suggested column title for the designated column for use in printouts and displays. |
String |
getColumnName |
Retrieves the name of the designated column. |
int |
getColumnType |
Retrieves the type code (one of the java.sql.Types constants) for the SQL type of the value stored in the designated column. |
String |
getColumnTypeName |
Retrieves the DBMS-specific type name for values stored in the designated column. |
int |
getPrecision |
Retrieves the total number of digits for values stored in the designated column. |
int |
getScale |
Retrieves the number of digits to the right of the decimal point for values stored in the designated column. |
String |
getSchemaName |
Retrieves the schema name of the table from which the value in the designated column was derived. |
String |
getTableName |
Retrieves the name of the table from which the value in the designated column was derived. |
boolean |
isAutoIncrement |
Retrieves whether a value stored in the designated column is automatically numbered, and thus readonly. |
boolean |
isCaseSensitive |
Indicates whether the case of the designated column's name matters. |
boolean |
isCurrency |
Indicates whether a value stored in the designated column is a cash value. |
boolean |
isDefinitelyWritable |
Indicates whether a write operation on the designated column will definitely succeed. |
int |
isNullable |
Retrieves a constant indicating whether it is possible to store a NULL value in the designated column. |
boolean |
isReadOnly |
Indicates whether the designated column is definitely not writable, thus readonly. |
boolean |
isSearchable |
Indicates whether a value stored in the designated column can be used in a WHERE clause. |
boolean |
isSigned |
Indicates whether a value stored in the designated column is a signed number. |
boolean |
isWrapperFor |
Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does. |
boolean |
isWritable |
Indicates whether it is possible for a write operation on the designated column to succeed. |
void |
setAutoIncrement |
Sets whether the designated column is automatically numbered, thus read-only, to the given boolean value. |
void |
setCaseSensitive |
Sets whether the name of the designated column is case sensitive to the given boolean . |
void |
setCatalogName |
Sets the catalog name of the table from which the designated column was derived to catalogName. |
void |
setColumnCount |
Sets to the given number the number of columns in the RowSet object for which this RowSetMetaDataImpl object was created. |
void |
setColumnDisplaySize |
Sets the normal maximum number of chars in the designated column to the given number. |
void |
setColumnLabel |
Sets the suggested column label for use in printouts and displays, if any, to label. |
void |
setColumnName |
Sets the column name of the designated column to the given name. |
void |
setColumnType |
Sets the SQL type code for values stored in the designated column to the given type code from the class java.sql.Types . |
void |
setColumnTypeName |
Sets the type name used by the data source for values stored in the designated column to the given type name. |
void |
setCurrency |
Sets whether a value stored in the designated column is a cash value to the given boolean . |
void |
setNullable |
Sets whether a value stored in the designated column can be set to NULL to the given constant from the interface ResultSetMetaData . |
void |
setPrecision |
Sets the total number of decimal digits in a value stored in the designated column to the given number. |
void |
setScale |
Sets the number of digits to the right of the decimal point in a value stored in the designated column to the given number. |
void |
setSchemaName |
Sets the designated column's table's schema name, if any, to schemaName. |
void |
setSearchable |
Sets whether a value stored in the designated column can be used in a WHERE clause to the given boolean value. |
void |
setSigned |
Sets whether a value stored in the designated column is a signed number to the given boolean . |
void |
setTableName |
Sets the name of the table from which the designated column was derived to the given table name. |
<T> T |
unwrap |
Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy. |
Constructor Details
RowSetMetaDataImpl
public RowSetMetaDataImpl()
RowSetMetaDataImpl
object.Method Details
setColumnCount
public void setColumnCount(int columnCount) throws SQLException
RowSet
object for which this RowSetMetaDataImpl
object was created.- Specified by:
-
setColumnCount
in interfaceRowSetMetaData
- Parameters:
-
columnCount
- anint
giving the number of columns in theRowSet
object - Throws:
-
SQLException
- if the given number is equal to or less than zero
setAutoIncrement
public void setAutoIncrement(int columnIndex, boolean property) throws SQLException
boolean
value.- Specified by:
-
setAutoIncrement
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns in the rowset, inclusive -
property
-true
if the given column is automatically incremented;false
otherwise - Throws:
-
SQLException
- if a database access error occurs or the given index is out of bounds
setCaseSensitive
public void setCaseSensitive(int columnIndex, boolean property) throws SQLException
boolean
.- Specified by:
-
setCaseSensitive
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns in the rowset, inclusive -
property
-true
to indicate that the column name is case sensitive;false
otherwise - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
setSearchable
public void setSearchable(int columnIndex, boolean property) throws SQLException
WHERE
clause to the given boolean
value.- Specified by:
-
setSearchable
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns in the rowset, inclusive -
property
-true
to indicate that a column value can be used in aWHERE
clause;false
otherwise - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
setCurrency
public void setCurrency(int columnIndex, boolean property) throws SQLException
boolean
.- Specified by:
-
setCurrency
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive between1
and the number of columns, inclusive -
property
- true if the value is a cash value; false otherwise. - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
setNullable
public void setNullable(int columnIndex, int property) throws SQLException
NULL
to the given constant from the interface ResultSetMetaData
.- Specified by:
-
setNullable
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive -
property
- one of the followingResultSetMetaData
constants:columnNoNulls
,columnNullable
, orcolumnNullableUnknown
- Throws:
-
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
, orResultSetMetaData.columnNullableUnknown
setSigned
public void setSigned(int columnIndex, boolean property) throws SQLException
boolean
.- Specified by:
-
setSigned
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive -
property
-true
to indicate that a column value is a signed number;false
to indicate that it is not - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
setColumnDisplaySize
public void setColumnDisplaySize(int columnIndex, int size) throws SQLException
- Specified by:
-
setColumnDisplaySize
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive -
size
- the maximum size of the column in chars; must be0
or more - Throws:
-
SQLException
- if a database access error occurs, the given column number is out of bounds, or size is less than0
setColumnLabel
public void setColumnLabel(int columnIndex, String label) throws SQLException
null
, the column label is set to an empty string ("").- Specified by:
-
setColumnLabel
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive -
label
- the column label to be used in printouts and displays; if the column label isnull
, an emptyString
is set - Throws:
-
SQLException
- if a database access error occurs or the given column index is out of bounds
setColumnName
public void setColumnName(int columnIndex, String columnName) throws SQLException
- Specified by:
-
setColumnName
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive -
columnName
- aString
object indicating the column name; if the given name isnull
, an emptyString
is set - Throws:
-
SQLException
- if a database access error occurs or the given column index is out of bounds
setSchemaName
public void setSchemaName(int columnIndex, String schemaName) throws SQLException
null
, the schema name is set to an empty string ("").- Specified by:
-
setSchemaName
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive -
schemaName
- the schema name for the table from which a value in the designated column was derived; may be an emptyString
ornull
- Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
setPrecision
public void setPrecision(int columnIndex, int precision) throws SQLException
- Specified by:
-
setPrecision
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive -
precision
- the total number of decimal digits; must be0
or more - Throws:
-
SQLException
- if a database access error occurs, columnIndex is out of bounds, or precision is less than0
setScale
public void setScale(int columnIndex, int scale) throws SQLException
- Specified by:
-
setScale
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive -
scale
- the number of digits to the right of the decimal point; must be zero or greater - Throws:
-
SQLException
- if a database access error occurs, columnIndex is out of bounds, or scale is less than0
setTableName
public void setTableName(int columnIndex, String tableName) throws SQLException
- Specified by:
-
setTableName
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive -
tableName
- the column's table name; may benull
or an empty string - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
setCatalogName
public void setCatalogName(int columnIndex, String catalogName) throws SQLException
null
, the catalog name is set to an empty string.- Specified by:
-
setCatalogName
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive -
catalogName
- the column's table's catalog name; if the catalogName isnull
, an emptyString
is set - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
setColumnType
public void setColumnType(int columnIndex, int SQLType) throws SQLException
java.sql.Types
.- Specified by:
-
setColumnType
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive -
SQLType
- the designated column's SQL type, which must be one of the constants in the classjava.sql.Types
- Throws:
-
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 injava.sql.Types
- See Also:
setColumnTypeName
public void setColumnTypeName(int columnIndex, String typeName) throws SQLException
- Specified by:
-
setColumnTypeName
in interfaceRowSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive -
typeName
- the data source-specific type name; if typeName isnull
, an emptyString
is set - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
getColumnCount
public int getColumnCount() throws SQLException
RowSet
object for which this RowSetMetaDataImpl
object was created.- Specified by:
-
getColumnCount
in interfaceResultSetMetaData
- Returns:
- the number of columns
- Throws:
-
SQLException
- if an error occurs determining the column count
isAutoIncrement
public boolean isAutoIncrement(int columnIndex) throws SQLException
- Specified by:
-
isAutoIncrement
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
-
true
if the column is automatically numbered;false
otherwise - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
isCaseSensitive
public boolean isCaseSensitive(int columnIndex) throws SQLException
- Specified by:
-
isCaseSensitive
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
-
true
if the column name is case sensitive;false
otherwise - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
isSearchable
public boolean isSearchable(int columnIndex) throws SQLException
WHERE
clause.- Specified by:
-
isSearchable
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
-
true
if a value in the designated column can be used in aWHERE
clause;false
otherwise - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
isCurrency
public boolean isCurrency(int columnIndex) throws SQLException
- Specified by:
-
isCurrency
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
-
true
if a value in the designated column is a cash value;false
otherwise - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
isNullable
public int isNullable(int columnIndex) throws SQLException
NULL
value in the designated column.- Specified by:
-
isNullable
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
- a constant from the
ResultSetMetaData
interface; eithercolumnNoNulls
,columnNullable
, orcolumnNullableUnknown
- Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
isSigned
public boolean isSigned(int columnIndex) throws SQLException
- Specified by:
-
isSigned
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
-
true
if a value in the designated column is a signed number;false
otherwise - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
getColumnDisplaySize
public int getColumnDisplaySize(int columnIndex) throws SQLException
- Specified by:
-
getColumnDisplaySize
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
- the maximum number of chars that can be displayed in the designated column
- Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
getColumnLabel
public String getColumnLabel(int columnIndex) throws SQLException
- Specified by:
-
getColumnLabel
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
- the suggested column name to use in printouts and displays
- Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
getColumnName
public String getColumnName(int columnIndex) throws SQLException
- Specified by:
-
getColumnName
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
- the column name of the designated column
- Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
getSchemaName
public String getSchemaName(int columnIndex) throws SQLException
- Specified by:
-
getSchemaName
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
- the schema name or an empty
String
if no schema name is available - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
getPrecision
public int getPrecision(int columnIndex) throws SQLException
- Specified by:
-
getPrecision
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
- the precision for values stored in the designated column
- Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
getScale
public int getScale(int columnIndex) throws SQLException
- Specified by:
-
getScale
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
- the scale for values stored in the designated column
- Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
getTableName
public String getTableName(int columnIndex) throws SQLException
- Specified by:
-
getTableName
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
- the table name or an empty
String
if no table name is available - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
getCatalogName
public String getCatalogName(int columnIndex) throws SQLException
- Specified by:
-
getCatalogName
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
- the catalog name of the column's table or an empty
String
if no catalog name is available - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
getColumnType
public int getColumnType(int columnIndex) throws SQLException
java.sql.Types
constants) for the SQL type of the value stored in the designated column.- Specified by:
-
getColumnType
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
- an
int
representing the SQL type of values stored in the designated column - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds - See Also:
getColumnTypeName
public String getColumnTypeName(int columnIndex) throws SQLException
- Specified by:
-
getColumnTypeName
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
- the type name used by the data source
- Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
isReadOnly
public boolean isReadOnly(int columnIndex) throws SQLException
- Specified by:
-
isReadOnly
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
-
true
if thisRowSet
object is read-Only and thus not updatable;false
otherwise - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
isWritable
public boolean isWritable(int columnIndex) throws SQLException
true
means that a write operation may or may not succeed.- Specified by:
-
isWritable
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
-
true
if a write operation on the designated column may will succeed;false
otherwise - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
isDefinitelyWritable
public boolean isDefinitelyWritable(int columnIndex) throws SQLException
- Specified by:
-
isDefinitelyWritable
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
-
true
if a write operation on the designated column will definitely succeed;false
otherwise - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
getColumnClassName
public String getColumnClassName(int columnIndex) throws SQLException
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.
- Specified by:
-
getColumnClassName
in interfaceResultSetMetaData
- Parameters:
-
columnIndex
- the first column is 1, the second is 2, and so on; must be between1
and the number of columns, inclusive - Returns:
- the fully-qualified name of the class in the Java programming language that would be used by the method
RowSet.getObject
to retrieve the value in the specified column. This is the class name used for custom mapping when there is a custom mapping. - Throws:
-
SQLException
- if a database access error occurs or the given column number is out of bounds
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
recursively on the wrapped object. If the receiver is not a wrapper and does not implement the interface, then an SQLException
is thrown.- Specified by:
-
unwrap
in interfaceWrapper
- Type Parameters:
-
T
- the type of the class modeled by this Class object - Parameters:
-
iface
- A Class defining an interface that the result must implement. - Returns:
- an object that implements the interface. May be a proxy for the actual implementing object.
- Throws:
-
SQLException
- If no object found that implements the interface - Since:
- 1.6
isWrapperFor
public boolean isWrapperFor(Class<?> interfaces) throws SQLException
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.- Specified by:
-
isWrapperFor
in interfaceWrapper
- Parameters:
-
interfaces
- a Class defining an interface. - Returns:
- true if this implements the interface or directly or indirectly wraps an object that does.
- Throws:
-
SQLException
- if an error occurs while determining whether this is a wrapper for an object with the given interface. - Since:
- 1.6
© 1993, 2021, 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.
https://docs.oracle.com/en/java/javase/17/docs/api/java.sql.rowset/javax/sql/rowset/RowSetMetaDataImpl.html