Package org.h2.jdbc

Class JdbcResultSetMetaData

java.lang.Object
org.h2.message.TraceObject
org.h2.jdbc.JdbcResultSetMetaData
All Implemented Interfaces:
ResultSetMetaData, Wrapper

public final class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaData
Represents the meta data for a ResultSet.
  • Field Details

  • Constructor Details

  • Method Details

    • getColumnCount

      public int getColumnCount() throws SQLException
      Returns the number of columns.
      Specified by:
      getColumnCount in interface ResultSetMetaData
      Returns:
      the number of columns
      Throws:
      SQLException - if the result set is closed or invalid
    • getColumnLabel

      public String getColumnLabel(int column) throws SQLException
      Returns the column label.
      Specified by:
      getColumnLabel in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      the column label
      Throws:
      SQLException - if the result set is closed or invalid
    • getColumnName

      public String getColumnName(int column) throws SQLException
      Returns the column name.
      Specified by:
      getColumnName in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      the column name
      Throws:
      SQLException - if the result set is closed or invalid
    • getColumnType

      public int getColumnType(int column) throws SQLException
      Returns the data type of a column. See also java.sql.Type.
      Specified by:
      getColumnType in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      the data type
      Throws:
      SQLException - if the result set is closed or invalid
    • getColumnTypeName

      public String getColumnTypeName(int column) throws SQLException
      Returns the data type name of a column.
      Specified by:
      getColumnTypeName in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      the data type name
      Throws:
      SQLException - if the result set is closed or invalid
    • getSchemaName

      public String getSchemaName(int column) throws SQLException
      Returns the schema name.
      Specified by:
      getSchemaName in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      the schema name, or "" (an empty string) if not applicable
      Throws:
      SQLException - if the result set is closed or invalid
    • getTableName

      public String getTableName(int column) throws SQLException
      Returns the table name.
      Specified by:
      getTableName in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      the table name
      Throws:
      SQLException - if the result set is closed or invalid
    • getCatalogName

      public String getCatalogName(int column) throws SQLException
      Returns the catalog name.
      Specified by:
      getCatalogName in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      the catalog name
      Throws:
      SQLException - if the result set is closed or invalid
    • isAutoIncrement

      public boolean isAutoIncrement(int column) throws SQLException
      Checks if this an autoincrement column.
      Specified by:
      isAutoIncrement in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      false
      Throws:
      SQLException - if the result set is closed or invalid
    • isCaseSensitive

      public boolean isCaseSensitive(int column) throws SQLException
      Checks if this column is case sensitive. It always returns true.
      Specified by:
      isCaseSensitive in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      true
      Throws:
      SQLException - if the result set is closed or invalid
    • isSearchable

      public boolean isSearchable(int column) throws SQLException
      Checks if this column is searchable. It always returns true.
      Specified by:
      isSearchable in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      true
      Throws:
      SQLException - if the result set is closed or invalid
    • isCurrency

      public boolean isCurrency(int column) throws SQLException
      Checks if this is a currency column. It always returns false.
      Specified by:
      isCurrency in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      false
      Throws:
      SQLException - if the result set is closed or invalid
    • isNullable

      public int isNullable(int column) throws SQLException
      Checks 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:
      isNullable in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      ResultSetMetaData.column*
      Throws:
      SQLException - if the result set is closed or invalid
    • isSigned

      public boolean isSigned(int column) throws SQLException
      Checks if this column is signed. Returns true for numeric columns.
      Specified by:
      isSigned in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      true for numeric columns
      Throws:
      SQLException - if the result set is closed or invalid
    • isReadOnly

      public boolean isReadOnly(int column) throws SQLException
      Checks if this column is read only. It always returns false.
      Specified by:
      isReadOnly in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      false
      Throws:
      SQLException - if the result set is closed or invalid
    • isWritable

      public boolean isWritable(int column) throws SQLException
      Checks whether it is possible for a write on this column to succeed. It always returns true.
      Specified by:
      isWritable in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      true
      Throws:
      SQLException - if the result set is closed or invalid
    • isDefinitelyWritable

      public boolean isDefinitelyWritable(int column) throws SQLException
      Checks whether a write on this column will definitely succeed. It always returns false.
      Specified by:
      isDefinitelyWritable in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      false
      Throws:
      SQLException - if the result set is closed or invalid
    • getColumnClassName

      public String getColumnClassName(int column) throws SQLException
      Gets the Java class name of the object that will be returned if ResultSet.getObject is called.
      Specified by:
      getColumnClassName in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      the Java class name
      Throws:
      SQLException - if the result set is closed or invalid
    • getPrecision

      public int getPrecision(int column) throws SQLException
      Gets the precision for this column.
      Specified by:
      getPrecision in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      the precision
      Throws:
      SQLException - if the result set is closed or invalid
    • getScale

      public int getScale(int column) throws SQLException
      Gets the scale for this column.
      Specified by:
      getScale in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      the scale
      Throws:
      SQLException - if the result set is closed or invalid
    • getColumnDisplaySize

      public int getColumnDisplaySize(int column) throws SQLException
      Gets the maximum display size for this column.
      Specified by:
      getColumnDisplaySize in interface ResultSetMetaData
      Parameters:
      column - the column index (1,2,...)
      Returns:
      the display size
      Throws:
      SQLException - if the result set is closed or invalid
    • checkClosed

      private void checkClosed()
    • getColumn

      private int getColumn(String methodName, int columnIndex)
      Writes trace information and checks validity of this object and parameter.
      Parameters:
      methodName - the called method name
      columnIndex - 1-based column index
      Returns:
      0-based column index
    • unwrap

      public <T> T unwrap(Class<T> iface) throws SQLException
      Return an object of this class if possible.
      Specified by:
      unwrap in interface Wrapper
      Parameters:
      iface - the class
      Returns:
      this
      Throws:
      SQLException
    • isWrapperFor

      public boolean isWrapperFor(Class<?> iface) throws SQLException
      Checks if unwrap can return an object of this class.
      Specified by:
      isWrapperFor in interface Wrapper
      Parameters:
      iface - the class
      Returns:
      whether or not the interface is assignable from this class
      Throws:
      SQLException
    • toString

      public String toString()
      INTERNAL
      Overrides:
      toString in class Object