Added in API level 1

ResultSetMetaData

interface ResultSetMetaData : Wrapper
java.sql.ResultSetMetaData

An object that can be used to get information about the types and properties of the columns in a ResultSet object. The following code fragment creates the ResultSet object rs, creates the ResultSetMetaData object rsmd, and uses rsmd to find out how many columns rs has and whether the first column in rs can be used in a WHERE clause.

ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
      ResultSetMetaData rsmd = rs.getMetaData();
      int numberOfColumns = rsmd.getColumnCount();
      boolean b = rsmd.isSearchable(1);
 
  

Summary

Constants
static Int

The constant indicating that a column does not allow NULL values.

static Int

The constant indicating that a column allows NULL values.

static Int

The constant indicating that the nullability of a column's values is unknown.

Public methods
abstract String!

Gets the designated column's table's catalog name.

abstract String!

Returns the fully-qualified name of the Java class whose instances are manufactured if the method ResultSet.getObject is called to retrieve a value from the column.

abstract Int

Returns the number of columns in this ResultSet object.

abstract Int

Indicates the designated column's normal maximum width in characters.

abstract String!

Gets the designated column's suggested title for use in printouts and displays.

abstract String!
getColumnName(column: Int)

Get the designated column's name.

abstract Int
getColumnType(column: Int)

Retrieves the designated column's SQL type.

abstract String!

Retrieves the designated column's database-specific type name.

abstract Int
getPrecision(column: Int)

Get the designated column's specified column size.

abstract Int
getScale(column: Int)

Gets the designated column's number of digits to right of the decimal point.

abstract String!
getSchemaName(column: Int)

Get the designated column's table's schema.

abstract String!
getTableName(column: Int)

Gets the designated column's table name.

abstract Boolean

Indicates whether the designated column is automatically numbered.

abstract Boolean

Indicates whether a column's case matters.

abstract Boolean
isCurrency(column: Int)

Indicates whether the designated column is a cash value.

abstract Boolean

Indicates whether a write on the designated column will definitely succeed.

abstract Int
isNullable(column: Int)

Indicates the nullability of values in the designated column.

abstract Boolean
isReadOnly(column: Int)

Indicates whether the designated column is definitely not writable.

abstract Boolean
isSearchable(column: Int)

Indicates whether the designated column can be used in a where clause.

abstract Boolean
isSigned(column: Int)

Indicates whether values in the designated column are signed numbers.

abstract Boolean
isWritable(column: Int)

Indicates whether it is possible for a write on the designated column to succeed.

Inherited functions

Constants

columnNoNulls

Added in API level 1
static val columnNoNulls: Int

The constant indicating that a column does not allow NULL values.

Value: 0

columnNullable

Added in API level 1
static val columnNullable: Int

The constant indicating that a column allows NULL values.

Value: 1

columnNullableUnknown

Added in API level 1
static val columnNullableUnknown: Int

The constant indicating that the nullability of a column's values is unknown.

Value: 2

Public methods

getCatalogName

Added in API level 1
abstract fun getCatalogName(column: Int): String!

Gets the designated column's table's catalog name.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
String! the name of the catalog for the table in which the given column appears or "" if not applicable
Exceptions
java.sql.SQLException if a database access error occurs

getColumnClassName

Added in API level 1
abstract fun getColumnClassName(column: Int): String!

Returns the fully-qualified name of the Java class whose instances are manufactured if the method ResultSet.getObject is called to retrieve a value from the column. ResultSet.getObject may return a subclass of the class returned by this method.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
String! the fully-qualified name of the class in the Java programming language that would be used by the method ResultSet.getObject to retrieve the value in the specified column. This is the class name used for custom mapping.
Exceptions
java.sql.SQLException if a database access error occurs

getColumnCount

Added in API level 1
abstract fun getColumnCount(): Int

Returns the number of columns in this ResultSet object.

Return
Int the number of columns
Exceptions
java.sql.SQLException if a database access error occurs

getColumnDisplaySize

Added in API level 1
abstract fun getColumnDisplaySize(column: Int): Int

Indicates the designated column's normal maximum width in characters.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Int the normal maximum number of characters allowed as the width of the designated column
Exceptions
java.sql.SQLException if a database access error occurs

getColumnLabel

Added in API level 1
abstract fun getColumnLabel(column: Int): String!

Gets the designated column's suggested title for use in printouts and displays. The suggested title is usually specified by the SQL AS clause. If a SQL AS is not specified, the value returned from getColumnLabel will be the same as the value returned by the getColumnName method.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
String! the suggested column title
Exceptions
java.sql.SQLException if a database access error occurs

getColumnName

Added in API level 1
abstract fun getColumnName(column: Int): String!

Get the designated column's name.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
String! column name
Exceptions
java.sql.SQLException if a database access error occurs

getColumnType

Added in API level 1
abstract fun getColumnType(column: Int): Int

Retrieves the designated column's SQL type.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Int SQL type from java.sql.Types
Exceptions
java.sql.SQLException if a database access error occurs

See Also

getColumnTypeName

Added in API level 1
abstract fun getColumnTypeName(column: Int): String!

Retrieves the designated column's database-specific type name.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
String! type name used by the database. If the column type is a user-defined type, then a fully-qualified type name is returned.
Exceptions
java.sql.SQLException if a database access error occurs

getPrecision

Added in API level 1
abstract fun getPrecision(column: Int): Int

Get the designated column's specified column size. For numeric data, this is the maximum precision. For character data, this is the length in characters. For datetime datatypes, this is the length in characters of the String representation (assuming the maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes. For the ROWID datatype, this is the length in bytes. 0 is returned for data types where the column size is not applicable.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Int precision
Exceptions
java.sql.SQLException if a database access error occurs

getScale

Added in API level 1
abstract fun getScale(column: Int): Int

Gets the designated column's number of digits to right of the decimal point. 0 is returned for data types where the scale is not applicable.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Int scale
Exceptions
java.sql.SQLException if a database access error occurs

getSchemaName

Added in API level 1
abstract fun getSchemaName(column: Int): String!

Get the designated column's table's schema.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
String! schema name or "" if not applicable
Exceptions
java.sql.SQLException if a database access error occurs

getTableName

Added in API level 1
abstract fun getTableName(column: Int): String!

Gets the designated column's table name.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
String! table name or "" if not applicable
Exceptions
java.sql.SQLException if a database access error occurs

isAutoIncrement

Added in API level 1
abstract fun isAutoIncrement(column: Int): Boolean

Indicates whether the designated column is automatically numbered.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Boolean true if so; false otherwise
Exceptions
java.sql.SQLException if a database access error occurs

isCaseSensitive

Added in API level 1
abstract fun isCaseSensitive(column: Int): Boolean

Indicates whether a column's case matters.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Boolean true if so; false otherwise
Exceptions
java.sql.SQLException if a database access error occurs

isCurrency

Added in API level 1
abstract fun isCurrency(column: Int): Boolean

Indicates whether the designated column is a cash value.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Boolean true if so; false otherwise
Exceptions
java.sql.SQLException if a database access error occurs

isDefinitelyWritable

Added in API level 1
abstract fun isDefinitelyWritable(column: Int): Boolean

Indicates whether a write on the designated column will definitely succeed.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Boolean true if so; false otherwise
Exceptions
java.sql.SQLException if a database access error occurs

isNullable

Added in API level 1
abstract fun isNullable(column: Int): Int

Indicates the nullability of values in the designated column.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Int the nullability status of the given column; one of columnNoNulls, columnNullable or columnNullableUnknown
Exceptions
java.sql.SQLException if a database access error occurs

isReadOnly

Added in API level 1
abstract fun isReadOnly(column: Int): Boolean

Indicates whether the designated column is definitely not writable.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Boolean true if so; false otherwise
Exceptions
java.sql.SQLException if a database access error occurs

isSearchable

Added in API level 1
abstract fun isSearchable(column: Int): Boolean

Indicates whether the designated column can be used in a where clause.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Boolean true if so; false otherwise
Exceptions
java.sql.SQLException if a database access error occurs

isSigned

Added in API level 1
abstract fun isSigned(column: Int): Boolean

Indicates whether values in the designated column are signed numbers.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Boolean true if so; false otherwise
Exceptions
java.sql.SQLException if a database access error occurs

isWritable

Added in API level 1
abstract fun isWritable(column: Int): Boolean

Indicates whether it is possible for a write on the designated column to succeed.

Parameters
column Int: the first column is 1, the second is 2, ...
Return
Boolean true if so; false otherwise
Exceptions
java.sql.SQLException if a database access error occurs