Package org.h2.jdbc
Class JdbcResultSetMetaData
- java.lang.Object
-
- org.h2.message.TraceObject
-
- org.h2.jdbc.JdbcResultSetMetaData
-
- All Implemented Interfaces:
java.sql.ResultSetMetaData,java.sql.Wrapper
public final class JdbcResultSetMetaData extends TraceObject implements java.sql.ResultSetMetaData
Represents the meta data for a ResultSet.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringcatalogprivate intcolumnCountprivate JdbcPreparedStatementprepprivate ResultInterfaceresultprivate JdbcResultSetrs-
Fields inherited from class org.h2.message.TraceObject
ARRAY, BLOB, CALLABLE_STATEMENT, CLOB, CONNECTION, DATA_SOURCE, DATABASE_META_DATA, PARAMETER_META_DATA, PREPARED_STATEMENT, RESULT_SET, RESULT_SET_META_DATA, SAVEPOINT, SQLXML, STATEMENT, trace, XA_DATA_SOURCE, XID
-
-
Constructor Summary
Constructors Constructor Description JdbcResultSetMetaData(JdbcResultSet rs, JdbcPreparedStatement prep, ResultInterface result, java.lang.String catalog, Trace trace, int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckClosed()java.lang.StringgetCatalogName(int column)Returns the catalog name.private intgetColumn(java.lang.String methodName, int columnIndex)Writes trace information and checks validity of this object and parameter.java.lang.StringgetColumnClassName(int column)Gets the Java class name of the object that will be returned if ResultSet.getObject is called.intgetColumnCount()Returns the number of columns.intgetColumnDisplaySize(int column)Gets the maximum display size for this column.java.lang.StringgetColumnLabel(int column)Returns the column label.java.lang.StringgetColumnName(int column)Returns the column name.intgetColumnType(int column)Returns the data type of a column.java.lang.StringgetColumnTypeName(int column)Returns the data type name of a column.intgetPrecision(int column)Gets the precision for this column.intgetScale(int column)Gets the scale for this column.java.lang.StringgetSchemaName(int column)Returns the schema name.java.lang.StringgetTableName(int column)Returns the table name.booleanisAutoIncrement(int column)Checks if this an autoincrement column.booleanisCaseSensitive(int column)Checks if this column is case sensitive.booleanisCurrency(int column)Checks if this is a currency column.booleanisDefinitelyWritable(int column)Checks whether a write on this column will definitely succeed.intisNullable(int column)Checks if this is nullable column.booleanisReadOnly(int column)Checks if this column is read only.booleanisSearchable(int column)Checks if this column is searchable.booleanisSigned(int column)Checks if this column is signed.booleanisWrapperFor(java.lang.Class<?> iface)Checks if unwrap can return an object of this class.booleanisWritable(int column)Checks whether it is possible for a write on this column to succeed.java.lang.StringtoString()INTERNAL<T> Tunwrap(java.lang.Class<T> iface)Return an object of this class if possible.-
Methods inherited from class org.h2.message.TraceObject
debugCode, debugCodeAssign, debugCodeCall, debugCodeCall, debugCodeCall, getNextId, getTraceId, getTraceObjectName, isDebugEnabled, isInfoEnabled, logAndConvert, quote, quoteArray, quoteBigDecimal, quoteBytes, quoteDate, quoteIntArray, quoteMap, quoteTime, quoteTimestamp, setTrace, unsupported
-
-
-
-
Field Detail
-
catalog
private final java.lang.String catalog
-
rs
private final JdbcResultSet rs
-
prep
private final JdbcPreparedStatement prep
-
result
private final ResultInterface result
-
columnCount
private final int columnCount
-
-
Constructor Detail
-
JdbcResultSetMetaData
JdbcResultSetMetaData(JdbcResultSet rs, JdbcPreparedStatement prep, ResultInterface result, java.lang.String catalog, Trace trace, int id)
-
-
Method Detail
-
getColumnCount
public int getColumnCount() throws java.sql.SQLExceptionReturns the number of columns.- Specified by:
getColumnCountin interfacejava.sql.ResultSetMetaData- Returns:
- the number of columns
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
getColumnLabel
public java.lang.String getColumnLabel(int column) throws java.sql.SQLExceptionReturns the column label.- Specified by:
getColumnLabelin interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- the column label
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
getColumnName
public java.lang.String getColumnName(int column) throws java.sql.SQLExceptionReturns the column name.- Specified by:
getColumnNamein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- the column name
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
getColumnType
public int getColumnType(int column) throws java.sql.SQLExceptionReturns the data type of a column. See also java.sql.Type.- Specified by:
getColumnTypein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- the data type
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
getColumnTypeName
public java.lang.String getColumnTypeName(int column) throws java.sql.SQLExceptionReturns the data type name of a column.- Specified by:
getColumnTypeNamein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- the data type name
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
getSchemaName
public java.lang.String getSchemaName(int column) throws java.sql.SQLExceptionReturns the schema name.- Specified by:
getSchemaNamein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- the schema name, or "" (an empty string) if not applicable
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
getTableName
public java.lang.String getTableName(int column) throws java.sql.SQLExceptionReturns the table name.- Specified by:
getTableNamein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- the table name
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
getCatalogName
public java.lang.String getCatalogName(int column) throws java.sql.SQLExceptionReturns the catalog name.- Specified by:
getCatalogNamein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- the catalog name
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
isAutoIncrement
public boolean isAutoIncrement(int column) throws java.sql.SQLExceptionChecks if this an autoincrement column.- Specified by:
isAutoIncrementin interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- false
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
isCaseSensitive
public boolean isCaseSensitive(int column) throws java.sql.SQLExceptionChecks if this column is case sensitive. It always returns true.- Specified by:
isCaseSensitivein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- true
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
isSearchable
public boolean isSearchable(int column) throws java.sql.SQLExceptionChecks if this column is searchable. It always returns true.- Specified by:
isSearchablein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- true
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
isCurrency
public boolean isCurrency(int column) throws java.sql.SQLExceptionChecks if this is a currency column. It always returns false.- Specified by:
isCurrencyin interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- false
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
isNullable
public int isNullable(int column) throws java.sql.SQLExceptionChecks if this is nullable column. Returns ResultSetMetaData.columnNullableUnknown if this is not a column of a table. Otherwise, it returns ResultSetMetaData.columnNoNulls if the column is not nullable, and ResultSetMetaData.columnNullable if it is nullable.- Specified by:
isNullablein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- ResultSetMetaData.column*
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
isSigned
public boolean isSigned(int column) throws java.sql.SQLExceptionChecks if this column is signed. Returns true for numeric columns.- Specified by:
isSignedin interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- true for numeric columns
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
isReadOnly
public boolean isReadOnly(int column) throws java.sql.SQLExceptionChecks if this column is read only. It always returns false.- Specified by:
isReadOnlyin interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- false
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
isWritable
public boolean isWritable(int column) throws java.sql.SQLExceptionChecks whether it is possible for a write on this column to succeed. It always returns true.- Specified by:
isWritablein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- true
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
isDefinitelyWritable
public boolean isDefinitelyWritable(int column) throws java.sql.SQLExceptionChecks whether a write on this column will definitely succeed. It always returns false.- Specified by:
isDefinitelyWritablein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- false
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
getColumnClassName
public java.lang.String getColumnClassName(int column) throws java.sql.SQLExceptionGets the Java class name of the object that will be returned if ResultSet.getObject is called.- Specified by:
getColumnClassNamein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- the Java class name
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
getPrecision
public int getPrecision(int column) throws java.sql.SQLExceptionGets the precision for this column.- Specified by:
getPrecisionin interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- the precision
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
getScale
public int getScale(int column) throws java.sql.SQLExceptionGets the scale for this column.- Specified by:
getScalein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- the scale
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
getColumnDisplaySize
public int getColumnDisplaySize(int column) throws java.sql.SQLExceptionGets the maximum display size for this column.- Specified by:
getColumnDisplaySizein interfacejava.sql.ResultSetMetaData- Parameters:
column- the column index (1,2,...)- Returns:
- the display size
- Throws:
java.sql.SQLException- if the result set is closed or invalid
-
checkClosed
private void checkClosed()
-
getColumn
private int getColumn(java.lang.String methodName, int columnIndex)Writes trace information and checks validity of this object and parameter.- Parameters:
methodName- the called method namecolumnIndex- 1-based column index- Returns:
- 0-based column index
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLExceptionReturn an object of this class if possible.- Specified by:
unwrapin interfacejava.sql.Wrapper- Parameters:
iface- the class- Returns:
- this
- Throws:
java.sql.SQLException
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLExceptionChecks if unwrap can return an object of this class.- Specified by:
isWrapperForin interfacejava.sql.Wrapper- Parameters:
iface- the class- Returns:
- whether or not the interface is assignable from this class
- Throws:
java.sql.SQLException
-
toString
public java.lang.String toString()
INTERNAL- Overrides:
toStringin classjava.lang.Object
-
-