Package java.sql

Interface ResultSetMetaData

All Superinterfaces:
Wrapper
All Known Subinterfaces:
RowSetMetaData
All Known Implementing Classes:
JDBCResultSetMetaData

public interface ResultSetMetaData
extends Wrapper
Provides information about the columns returned in a ResultSet.
  • Field Summary

    Fields
    Modifier and Type Field Description
    static int columnNoNulls
    Indicates that a column cannot contain NULL values.
    static int columnNullable
    Indicates that a column can contain NULL values.
    static int columnNullableUnknown
    Indicates that it is unknown whether a column can contain NULLs or not.
  • Method Summary

    Modifier and Type Method Description
    String getCatalogName​(int column)
    Returns the title of an indexed column's catalog.
    String getColumnClassName​(int column)
    Returns the fully-qualified type of the class that is produced when invoking ResultSet.getObject to recover this column's value.
    int getColumnCount()
    Returns number of columns contained in the associated result set.
    int getColumnDisplaySize​(int column)
    Returns the indexed column's standard maximum width, expressed in number of characters.
    String getColumnLabel​(int column)
    Returns a recommended title for the indexed column, to be used when the title needs to be displayed.
    String getColumnName​(int column)
    Returns the title of the indexed column.
    int getColumnType​(int column)
    Returns the type of the indexed column as SQL type code.
    String getColumnTypeName​(int column)
    Returns the type name of the indexed column.
    int getPrecision​(int column)
    Returns the decimal precision of the indexed column.
    int getScale​(int column)
    Returns the number of digits to the right of the decimal point of the indexed column.
    String getSchemaName​(int column)
    Returns the name of the indexed columns schema.
    String getTableName​(int column)
    Returns the title of the indexed columns table.
    boolean isAutoIncrement​(int column)
    Returns an indication of whether the indexed column is automatically incremented and is therefore read-only.
    boolean isCaseSensitive​(int column)
    Returns an indication of whether the case of the indexed column is important.
    boolean isCurrency​(int column)
    Returns whether the indexed column contains a monetary amount.
    boolean isDefinitelyWritable​(int column)
    Returns an indication of whether writing to the indexed column is guaranteed to be successful.
    int isNullable​(int column)
    Returns whether the indexed column is nullable.
    boolean isReadOnly​(int column)
    Returns an indication of whether writing to the indexed column is guaranteed to be unsuccessful.
    boolean isSearchable​(int column)
    Returns an indication of whether the indexed column is searchable.
    boolean isSigned​(int column)
    Returns an indication of whether the values contained in the indexed column are signed.
    boolean isWritable​(int column)
    Returns an indication of whether writing to the indexed column is possible.

    Methods inherited from interface java.sql.Wrapper

    isWrapperFor, unwrap
  • Field Details

    • columnNoNulls

      static final int columnNoNulls
      Indicates that a column cannot contain NULL values.
      See Also:
      Constant Field Values
    • columnNullable

      static final int columnNullable
      Indicates that a column can contain NULL values.
      See Also:
      Constant Field Values
    • columnNullableUnknown

      static final int columnNullableUnknown
      Indicates that it is unknown whether a column can contain NULLs or not.
      See Also:
      Constant Field Values
  • Method Details

    • getCatalogName

      String getCatalogName​(int column) throws SQLException
      Returns the title of an indexed column's catalog.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      the catalog title.
      Throws:
      SQLException - if there is a database error.
    • getColumnClassName

      String getColumnClassName​(int column) throws SQLException
      Returns the fully-qualified type of the class that is produced when invoking ResultSet.getObject to recover this column's value.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      the fully-qualified class name.
      Throws:
      SQLException - if there is a database error.
      See Also:
      ResultSet.getObject(int)
    • getColumnCount

      int getColumnCount() throws SQLException
      Returns number of columns contained in the associated result set.
      Returns:
      the column count.
      Throws:
      SQLException - if there is a database error.
    • getColumnDisplaySize

      int getColumnDisplaySize​(int column) throws SQLException
      Returns the indexed column's standard maximum width, expressed in number of characters.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      the column's max width.
      Throws:
      SQLException - if there is a database error.
    • getColumnLabel

      String getColumnLabel​(int column) throws SQLException
      Returns a recommended title for the indexed column, to be used when the title needs to be displayed.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      the column's title.
      Throws:
      SQLException - if there is a database error.
    • getColumnName

      String getColumnName​(int column) throws SQLException
      Returns the title of the indexed column.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      the column title.
      Throws:
      SQLException - if there is a database error.
    • getColumnType

      int getColumnType​(int column) throws SQLException
      Returns the type of the indexed column as SQL type code.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      the column type code.
      Throws:
      SQLException - if there is a database error.
      See Also:
      Types
    • getColumnTypeName

      String getColumnTypeName​(int column) throws SQLException
      Returns the type name of the indexed column.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      the type name.
      Throws:
      SQLException - if there is a database error.
    • getPrecision

      int getPrecision​(int column) throws SQLException
      Returns the decimal precision of the indexed column.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      the precision.
      Throws:
      SQLException - if there is a database error.
    • getScale

      int getScale​(int column) throws SQLException
      Returns the number of digits to the right of the decimal point of the indexed column.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      number of decimal places.
      Throws:
      SQLException - if there is a database error.
    • getSchemaName

      String getSchemaName​(int column) throws SQLException
      Returns the name of the indexed columns schema.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      the name of the columns schema.
      Throws:
      SQLException - if there is a database error.
    • getTableName

      String getTableName​(int column) throws SQLException
      Returns the title of the indexed columns table.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      the table title.
      Throws:
      SQLException - if there is a database error.
    • isAutoIncrement

      boolean isAutoIncrement​(int column) throws SQLException
      Returns an indication of whether the indexed column is automatically incremented and is therefore read-only.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      true if it is automatically numbered, false otherwise.
      Throws:
      SQLException - if there is a database error.
    • isCaseSensitive

      boolean isCaseSensitive​(int column) throws SQLException
      Returns an indication of whether the case of the indexed column is important.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      true if case matters, false otherwise.
      Throws:
      SQLException - if there is a database error.
    • isCurrency

      boolean isCurrency​(int column) throws SQLException
      Returns whether the indexed column contains a monetary amount.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      true if it is a monetary value, false otherwise.
      Throws:
      SQLException - if there is a database error.
    • isDefinitelyWritable

      boolean isDefinitelyWritable​(int column) throws SQLException
      Returns an indication of whether writing to the indexed column is guaranteed to be successful.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      true if the write is guaranteed, false otherwise.
      Throws:
      SQLException - if there is a database error.
    • isNullable

      int isNullable​(int column) throws SQLException
      Returns whether the indexed column is nullable.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      true if it is nullable, false otherwise.
      Throws:
      SQLException - if there is a database error.
    • isReadOnly

      boolean isReadOnly​(int column) throws SQLException
      Returns an indication of whether writing to the indexed column is guaranteed to be unsuccessful.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      true if the column is read-only, false otherwise.
      Throws:
      SQLException - if there is a database error.
    • isSearchable

      boolean isSearchable​(int column) throws SQLException
      Returns an indication of whether the indexed column is searchable.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      true if the indexed column is searchable, false otherwise.
      Throws:
      SQLException - if there is a database error.
    • isSigned

      boolean isSigned​(int column) throws SQLException
      Returns an indication of whether the values contained in the indexed column are signed.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      true if they are signed, false otherwise.
      Throws:
      SQLException - if there is a database error.
    • isWritable

      boolean isWritable​(int column) throws SQLException
      Returns an indication of whether writing to the indexed column is possible.
      Parameters:
      column - the column index, starting at 1.
      Returns:
      true if it is possible to write, false otherwise.
      Throws:
      SQLException - if there is a database error.