public class EmbedResultSetMetaData
extends java.lang.Object
implements java.sql.ResultSetMetaData
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.
Modifier and Type | Field and Description |
---|---|
private ResultColumnDescriptor[] |
columnInfo |
Constructor and Description |
---|
EmbedResultSetMetaData(ResultColumnDescriptor[] columnInfo) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getCatalogName(int column)
What's a column's table's catalog name?
|
java.lang.String |
getColumnClassName(int column)
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.
|
int |
getColumnCount()
What's the number of columns in the ResultSet?
|
int |
getColumnDisplaySize(int column)
What's the column's normal max width in chars?
|
java.lang.String |
getColumnLabel(int column)
What's the suggested column title for use in printouts and
displays?
|
java.lang.String |
getColumnName(int column)
What's a column's name?
|
int |
getColumnType(int column)
What's a column's SQL type?
|
private DataTypeDescriptor |
getColumnTypeDescriptor(int column) |
java.lang.String |
getColumnTypeName(int column)
What's a column's data source specific type name?
|
int |
getPrecision(int column)
What's a column's number of decimal digits?
|
static ResultColumnDescriptor |
getResultColumnDescriptor(java.lang.String name,
DataTypeDescriptor dtd) |
static ResultColumnDescriptor |
getResultColumnDescriptor(java.lang.String name,
int jdcbTypeId,
boolean nullable) |
static ResultColumnDescriptor |
getResultColumnDescriptor(java.lang.String name,
int jdcbTypeId,
boolean nullable,
int length) |
int |
getScale(int column)
What's a column's number of digits to right of the decimal point?
|
java.lang.String |
getSchemaName(int column)
What's a column's table's schema?
|
java.lang.String |
getTableName(int column)
What's a column's table name?
|
boolean |
isAutoIncrement(int column)
Is the column automatically numbered, thus read-only?
|
boolean |
isCaseSensitive(int column)
Does a column's case matter?
|
boolean |
isCurrency(int column)
Is the column a cash value?
|
boolean |
isDefinitelyWritable(int column)
Will a write on the column definitely succeed?
|
int |
isNullable(int column)
Can you put a NULL in this column?
|
boolean |
isReadOnly(int column)
Is a column definitely not writable?
|
boolean |
isSearchable(int column)
Can the column be used in a where clause?
|
boolean |
isSigned(int column)
Is the column a signed number?
|
boolean |
isWrapperFor(java.lang.Class<?> iface)
Returns whether or not this instance implements the specified interface.
|
boolean |
isWritable(int column)
Is it possible for a write on the column to succeed?
|
<T> T |
unwrap(java.lang.Class<T> iface)
Returns
this if this class implements the interface. |
private void |
validColumnNumber(int column) |
private final ResultColumnDescriptor[] columnInfo
public EmbedResultSetMetaData(ResultColumnDescriptor[] columnInfo)
public final int getColumnCount()
getColumnCount
in interface java.sql.ResultSetMetaData
public final boolean isAutoIncrement(int column) throws java.sql.SQLException
isAutoIncrement
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final boolean isCaseSensitive(int column) throws java.sql.SQLException
isCaseSensitive
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final boolean isSearchable(int column) throws java.sql.SQLException
isSearchable
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final boolean isCurrency(int column) throws java.sql.SQLException
isCurrency
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final int isNullable(int column) throws java.sql.SQLException
isNullable
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final boolean isSigned(int column) throws java.sql.SQLException
isSigned
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final int getColumnDisplaySize(int column) throws java.sql.SQLException
getColumnDisplaySize
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final java.lang.String getColumnLabel(int column) throws java.sql.SQLException
getColumnLabel
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final java.lang.String getColumnName(int column) throws java.sql.SQLException
getColumnName
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final java.lang.String getSchemaName(int column) throws java.sql.SQLException
getSchemaName
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final int getPrecision(int column) throws java.sql.SQLException
getPrecision
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final int getScale(int column) throws java.sql.SQLException
getScale
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final java.lang.String getTableName(int column) throws java.sql.SQLException
getTableName
in interface java.sql.ResultSetMetaData
java.sql.SQLException
- thrown on failurepublic final java.lang.String getCatalogName(int column) throws java.sql.SQLException
getCatalogName
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final int getColumnType(int column) throws java.sql.SQLException
getColumnType
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failureTypes
public final java.lang.String getColumnTypeName(int column) throws java.sql.SQLException
getColumnTypeName
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final boolean isReadOnly(int column) throws java.sql.SQLException
isReadOnly
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final boolean isWritable(int column) throws java.sql.SQLException
isWritable
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failurepublic final boolean isDefinitelyWritable(int column) throws java.sql.SQLException
isDefinitelyWritable
in interface java.sql.ResultSetMetaData
column
- the first column is 1, the second is 2, ...java.sql.SQLException
- thrown on failureprivate void validColumnNumber(int column) throws java.sql.SQLException
java.sql.SQLException
private DataTypeDescriptor getColumnTypeDescriptor(int column) throws java.sql.SQLException
java.sql.SQLException
public final java.lang.String getColumnClassName(int column) throws java.sql.SQLException
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.
getColumnClassName
in interface java.sql.ResultSetMetaData
java.sql.SQLException
- Feature not inplemented for now.public static ResultColumnDescriptor getResultColumnDescriptor(java.lang.String name, int jdcbTypeId, boolean nullable)
public static ResultColumnDescriptor getResultColumnDescriptor(java.lang.String name, int jdcbTypeId, boolean nullable, int length)
public static ResultColumnDescriptor getResultColumnDescriptor(java.lang.String name, DataTypeDescriptor dtd)
public final boolean isWrapperFor(java.lang.Class<?> iface)
isWrapperFor
in interface java.sql.Wrapper
iface
- the interface to check forpublic final <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
this
if this class implements the interface.unwrap
in interface java.sql.Wrapper
iface
- the interfacejava.sql.SQLException
- if no object is found that implements the
interfaceApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.