Top Description Fields Constructors Methods
org.apache.derby.impl.jdbc

public Class EmbedResultSetMetaData

extends Object
implements ResultSetMetaData
Class Inheritance
All Implemented Interfaces
java.sql.ResultSetMetaData, java.sql.Wrapper
Imports
org.apache.derby.shared.common.util.ArrayUtil, org.apache.derby.iapi.sql.ResultColumnDescriptor, org.apache.derby.iapi.types.DataTypeDescriptor, .DataTypeUtilities, org.apache.derby.shared.common.reference.SQLState, java.sql.ResultSetMetaData, .SQLException, .Types

A ResultSetMetaData object can be used to find out about the types and properties of the columns in a ResultSet.

We take the (Derby) ResultDescription and examine it, to return the appropriate information.

This class can be used outside of this package to convert a ResultDescription into a ResultSetMetaData object.

EmbedResultSetMetaData objects are shared across multiple threads by being stored in the ResultDescription for a compiled plan. If the required api for ResultSetMetaData ever changes so that it has a close() method, a getConnection() method or any other Connection or ResultSet specific method then this sharing must be removed.

Field Summary

Modifier and TypeField and Description
private final ResultColumnDescriptor[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final String

Returns:

column name or "" if not applicable.
getCatalogName
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.getCatalogName.

What's a column's table's catalog name?

public final String
getColumnClassName(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.getColumnClassName.

JDBC 2.0

Return the fully qualified name of the Java class whose instances are manufactured if ResultSet.getObject() is called to retrieve a value from the column.

public final int

Returns:

the number
getColumnCount
()

Implements java.sql.ResultSetMetaData.getColumnCount.

What's the number of columns in the ResultSet?

public final int

Returns:

max width
getColumnDisplaySize
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.getColumnDisplaySize.

What's the column's normal max width in chars?

public final String

Returns:

true if so
getColumnLabel
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.getColumnLabel.

What's the suggested column title for use in printouts and displays?

public final String

Returns:

column name
getColumnName
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.getColumnName.

What's a column's name?

public final int

Returns:

SQL type
getColumnType
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.getColumnType.

What's a column's SQL type?

private DataTypeDescriptor
public final String

Returns:

type name
getColumnTypeName
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.getColumnTypeName.

What's a column's data source specific type name?

public final int

Returns:

precision
getPrecision
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.getPrecision.

What's a column's number of decimal digits?

public static ResultColumnDescriptor
getResultColumnDescriptor(String name, int jdcbTypeId, boolean nullable)

public static ResultColumnDescriptor
getResultColumnDescriptor(String name, int jdcbTypeId, boolean nullable, int length)

public static ResultColumnDescriptor
public final int

Returns:

scale
getScale
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.getScale.

What's a column's number of digits to right of the decimal point?

public final String

Returns:

schema name or "" if not applicable
getSchemaName
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.getSchemaName.

What's a column's table's schema?

public final String

Returns:

table name or "" if not applicable
getTableName
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.getTableName.

What's a column's table name?

public final boolean

Returns:

true if so
isAutoIncrement
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.isAutoIncrement.

Is the column automatically numbered, thus read-only?

public final boolean

Returns:

true if so
isCaseSensitive
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.isCaseSensitive.

Does a column's case matter?

public final boolean

Returns:

false, always
isCurrency
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.isCurrency.

Is the column a cash value?

public final boolean

Returns:

true if so
isDefinitelyWritable
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.isDefinitelyWritable.

Will a write on the column definitely succeed?

public final int

Returns:

columnNoNulls, columnNullable or columnNullableUnknown
isNullable
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.isNullable.

Can you put a NULL in this column?

public final boolean

Returns:

true if so
isReadOnly
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.isReadOnly.

Is a column definitely not writable?

public final boolean

Returns:

true if so
isSearchable
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.isSearchable.

Can the column be used in a where clause?

public final boolean

Returns:

true if so
isSigned
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.isSigned.

Is the column a signed number?

public final boolean

Returns:

true if this implements the interface
isWrapperFor
(Class<?>
the interface to check for
iface
)

Implements java.sql.Wrapper.isWrapperFor.

Returns whether or not this instance implements the specified interface.

public final boolean

Returns:

true if so
isWritable
(int
the first column is 1, the second is 2, ...
column
)

Implements java.sql.ResultSetMetaData.isWritable.

Is it possible for a write on the column to succeed?

public final <T> T

Returns:

an object that implements the interface
unwrap
(Class<T>
the interface
iface
)

Implements java.sql.Wrapper.unwrap.

Returns this if this class implements the interface.

private void
validColumnNumber(int column)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

columnInfoback to summary
private final ResultColumnDescriptor[] columnInfo

Constructor Detail

EmbedResultSetMetaDataback to summary
public EmbedResultSetMetaData(ResultColumnDescriptor[] columnInfo)

Method Detail

getCatalogNameback to summary
public final String getCatalogName(int column) throws SQLException

Implements java.sql.ResultSetMetaData.getCatalogName.

What's a column's table's catalog name?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:String

column name or "" if not applicable.

Exceptions
SQLException:
thrown on failure
getColumnClassNameback to summary
public final String getColumnClassName(int column) throws SQLException

Implements java.sql.ResultSetMetaData.getColumnClassName.

JDBC 2.0

Return the fully qualified name of the Java class whose instances are manufactured if 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

Doc from java.sql.ResultSetMetaData.getColumnClassName.

the first column is 1, the second is 2, ...

Returns:String

Doc from java.sql.ResultSetMetaData.getColumnClassName.

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
SQLException:
Feature not inplemented for now.
getColumnCountback to summary
public final int getColumnCount()

Implements java.sql.ResultSetMetaData.getColumnCount.

What's the number of columns in the ResultSet?

Returns:int

the number

getColumnDisplaySizeback to summary
public final int getColumnDisplaySize(int column) throws SQLException

Implements java.sql.ResultSetMetaData.getColumnDisplaySize.

What's the column's normal max width in chars?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:int

max width

Exceptions
SQLException:
thrown on failure
getColumnLabelback to summary
public final String getColumnLabel(int column) throws SQLException

Implements java.sql.ResultSetMetaData.getColumnLabel.

What's the suggested column title for use in printouts and displays?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:String

true if so

Exceptions
SQLException:
thrown on failure
getColumnNameback to summary
public final String getColumnName(int column) throws SQLException

Implements java.sql.ResultSetMetaData.getColumnName.

What's a column's name?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:String

column name

Exceptions
SQLException:
thrown on failure
getColumnTypeback to summary
public final int getColumnType(int column) throws SQLException

Implements java.sql.ResultSetMetaData.getColumnType.

What's a column's SQL type?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:int

SQL type

Exceptions
SQLException:
thrown on failure
See Also
Types
getColumnTypeDescriptorback to summary
private DataTypeDescriptor getColumnTypeDescriptor(int column) throws SQLException
getColumnTypeNameback to summary
public final String getColumnTypeName(int column) throws SQLException

Implements java.sql.ResultSetMetaData.getColumnTypeName.

What's a column's data source specific type name?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:String

type name

Exceptions
SQLException:
thrown on failure
getPrecisionback to summary
public final int getPrecision(int column) throws SQLException

Implements java.sql.ResultSetMetaData.getPrecision.

What's a column's number of decimal digits?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:int

precision

Exceptions
SQLException:
thrown on failure
getResultColumnDescriptorback to summary
public static ResultColumnDescriptor getResultColumnDescriptor(String name, int jdcbTypeId, boolean nullable)
getResultColumnDescriptorback to summary
public static ResultColumnDescriptor getResultColumnDescriptor(String name, int jdcbTypeId, boolean nullable, int length)
getResultColumnDescriptorback to summary
public static ResultColumnDescriptor getResultColumnDescriptor(String name, DataTypeDescriptor dtd)
getScaleback to summary
public final int getScale(int column) throws SQLException

Implements java.sql.ResultSetMetaData.getScale.

What's a column's number of digits to right of the decimal point?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:int

scale

Exceptions
SQLException:
thrown on failure
getSchemaNameback to summary
public final String getSchemaName(int column) throws SQLException

Implements java.sql.ResultSetMetaData.getSchemaName.

What's a column's table's schema?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:String

schema name or "" if not applicable

Exceptions
SQLException:
thrown on failure
getTableNameback to summary
public final String getTableName(int column) throws SQLException

Implements java.sql.ResultSetMetaData.getTableName.

What's a column's table name?

Parameters
column:int

Doc from java.sql.ResultSetMetaData.getTableName.

the first column is 1, the second is 2, ...

Returns:String

table name or "" if not applicable

Exceptions
SQLException:
thrown on failure
isAutoIncrementback to summary
public final boolean isAutoIncrement(int column) throws SQLException

Implements java.sql.ResultSetMetaData.isAutoIncrement.

Is the column automatically numbered, thus read-only?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:boolean

true if so

Exceptions
SQLException:
thrown on failure
isCaseSensitiveback to summary
public final boolean isCaseSensitive(int column) throws SQLException

Implements java.sql.ResultSetMetaData.isCaseSensitive.

Does a column's case matter?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:boolean

true if so

Exceptions
SQLException:
thrown on failure
isCurrencyback to summary
public final boolean isCurrency(int column) throws SQLException

Implements java.sql.ResultSetMetaData.isCurrency.

Is the column a cash value? Always returns false since there are no currency data types in Derby.

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:boolean

false, always

Exceptions
SQLException:
thrown on failure
isDefinitelyWritableback to summary
public final boolean isDefinitelyWritable(int column) throws SQLException

Implements java.sql.ResultSetMetaData.isDefinitelyWritable.

Will a write on the column definitely succeed?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:boolean

true if so

Exceptions
SQLException:
thrown on failure
isNullableback to summary
public final int isNullable(int column) throws SQLException

Implements java.sql.ResultSetMetaData.isNullable.

Can you put a NULL in this column?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:int

columnNoNulls, columnNullable or columnNullableUnknown

Exceptions
SQLException:
thrown on failure
isReadOnlyback to summary
public final boolean isReadOnly(int column) throws SQLException

Implements java.sql.ResultSetMetaData.isReadOnly.

Is a column definitely not writable?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:boolean

true if so

Exceptions
SQLException:
thrown on failure
isSearchableback to summary
public final boolean isSearchable(int column) throws SQLException

Implements java.sql.ResultSetMetaData.isSearchable.

Can the column be used in a where clause?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:boolean

true if so

Exceptions
SQLException:
thrown on failure
isSignedback to summary
public final boolean isSigned(int column) throws SQLException

Implements java.sql.ResultSetMetaData.isSigned.

Is the column a signed number?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:boolean

true if so

Exceptions
SQLException:
thrown on failure
isWrapperForback to summary
public final boolean isWrapperFor(Class<?> iface)

Implements java.sql.Wrapper.isWrapperFor.

Returns whether or not this instance implements the specified interface.

Parameters
iface:Class<?>

the interface to check for

Returns:boolean

true if this implements the interface

isWritableback to summary
public final boolean isWritable(int column) throws SQLException

Implements java.sql.ResultSetMetaData.isWritable.

Is it possible for a write on the column to succeed?

Parameters
column:int

the first column is 1, the second is 2, ...

Returns:boolean

true if so

Exceptions
SQLException:
thrown on failure
unwrapback to summary
public final <T> T unwrap(Class<T> iface) throws SQLException

Implements java.sql.Wrapper.unwrap.

Returns this if this class implements the interface.

Parameters
<T>

Doc from java.sql.Wrapper.unwrap. the type of the class modeled by this Class object

iface:Class<T>

the interface

Returns:T

an object that implements the interface

Exceptions
SQLException:
if no object is found that implements the interface
validColumnNumberback to summary
private void validColumnNumber(int column) throws SQLException