Package org.apache.derby.vti
Class VTIMetaDataTemplate
- java.lang.Object
-
- org.apache.derby.vti.VTIMetaDataTemplate
-
- All Implemented Interfaces:
java.sql.ResultSetMetaData,java.sql.Wrapper
- Direct Known Subclasses:
ImportResultSetMetaData
public abstract class VTIMetaDataTemplate extends java.lang.Object implements java.sql.ResultSetMetaDataAn abstract implementation of ResultSetMetaData (JDBC 1.2) that is useful when writing a VTI (virtual table interface). This class implements most of the methods of ResultSetMetaData, each one throwing a SQLException with the name of the method. A concrete subclass can then just implement the methods not implemented here and override any methods it needs to implement for correct functionality.The methods not implemented here are
- getColumnCount()
- getColumnType()
For virtual tables the database engine only calls methods defined in the JDBC 1.2 definition of java.sql.ResultSetMetaData.
Classes that implement a JDBC 2.0 conformant java.sql.ResultSetMetaData can be used as the meta data for virtual tables.
Developers can use the VTIMetaDataTemplate20 instead of this class when developing in a Java 2 environment.
-
-
Constructor Summary
Constructors Constructor Description VTIMetaDataTemplate()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCatalogName(int column)What's a column's table's catalog name?java.lang.StringgetColumnClassName(int column)Returns the fully-qualified name of the Java class whose instances are manufactured if the methodResultSet.getObjectis called to retrieve a value from the column.intgetColumnDisplaySize(int column)What's the column's normal maximum width in chars?java.lang.StringgetColumnLabel(int column)What's the suggested column title for use in printouts and displays?java.lang.StringgetColumnName(int column)What's a column's name?java.lang.StringgetColumnTypeName(int column)What's a column's data source specific type name?intgetPrecision(int column)How many decimal digits are in the column?intgetScale(int column)What's a column's number of digits to the right of the decimal point?java.lang.StringgetSchemaName(int column)What's a column's table's schema?java.lang.StringgetTableName(int column)What's a column's table name?booleanisAutoIncrement(int column)Is the column automatically numbered, and thus read-only?booleanisCaseSensitive(int column)Does a column's case matter?booleanisCurrency(int column)Is the column a cash value?booleanisDefinitelyWritable(int column)Will a write on the column definitely succeed?intisNullable(int column)Can you put a NULL in this column?booleanisReadOnly(int column)Is a column definitely not writable?booleanisSearchable(int column)Can the column be used in a WHERE clause?booleanisSigned(int column)Is the column a signed number?booleanisWrapperFor(java.lang.Class<?> iface)booleanisWritable(int column)Is it possible for a write on the column to succeed?protected java.sql.SQLExceptionnotImplemented(java.lang.String methodName)Create a SQLException saying that the calling method is not implemented.<T> Tunwrap(java.lang.Class<T> iface)
-
-
-
Method Detail
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException- Specified by:
isWrapperForin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException- Specified by:
unwrapin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
isAutoIncrement
public boolean isAutoIncrement(int column) throws java.sql.SQLExceptionIs the column automatically numbered, and thus read-only?- Specified by:
isAutoIncrementin interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- true if the column is automatically numbered
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
isCaseSensitive
public boolean isCaseSensitive(int column) throws java.sql.SQLExceptionDoes a column's case matter?- Specified by:
isCaseSensitivein interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- true if the column is case-sensitive
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
isSearchable
public boolean isSearchable(int column) throws java.sql.SQLExceptionCan the column be used in a WHERE clause?- Specified by:
isSearchablein interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- true if the column is searchable
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
isCurrency
public boolean isCurrency(int column) throws java.sql.SQLExceptionIs the column a cash value?- Specified by:
isCurrencyin interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- true if the column is a cash value
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
isNullable
public int isNullable(int column) throws java.sql.SQLExceptionCan you put a NULL in this column?- Specified by:
isNullablein interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- columnNoNulls, columnNullable or columnNullableUnknown
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
isSigned
public boolean isSigned(int column) throws java.sql.SQLExceptionIs the column a signed number?- Specified by:
isSignedin interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- true if the column is a signed number
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
getColumnDisplaySize
public int getColumnDisplaySize(int column) throws java.sql.SQLExceptionWhat's the column's normal maximum width in chars?- Specified by:
getColumnDisplaySizein interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- the column's maximum width
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
getColumnLabel
public java.lang.String getColumnLabel(int column) throws java.sql.SQLExceptionWhat's the suggested column title for use in printouts and displays?- Specified by:
getColumnLabelin interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- the column's title
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
getColumnName
public java.lang.String getColumnName(int column) throws java.sql.SQLExceptionWhat's a column's name?- Specified by:
getColumnNamein interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- column name
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
getSchemaName
public java.lang.String getSchemaName(int column) throws java.sql.SQLExceptionWhat's a column's table's schema?- Specified by:
getSchemaNamein interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- schema name or "" if not applicable
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
getPrecision
public int getPrecision(int column) throws java.sql.SQLExceptionHow many decimal digits are in the column?- Specified by:
getPrecisionin interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- the column's precision
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
getScale
public int getScale(int column) throws java.sql.SQLExceptionWhat's a column's number of digits to the right of the decimal point?- Specified by:
getScalein interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- the column's scale
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
getTableName
public java.lang.String getTableName(int column) throws java.sql.SQLExceptionWhat's a column's table name?- Specified by:
getTableNamein interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- the column's table name or "" if not applicable
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
getCatalogName
public java.lang.String getCatalogName(int column) throws java.sql.SQLExceptionWhat's a column's table's catalog name?- Specified by:
getCatalogNamein interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- the column's table's catalog name or "" if not applicable.
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
getColumnTypeName
public java.lang.String getColumnTypeName(int column) throws java.sql.SQLExceptionWhat's a column's data source specific type name?- Specified by:
getColumnTypeNamein interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- the column's type name
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
isReadOnly
public boolean isReadOnly(int column) throws java.sql.SQLExceptionIs a column definitely not writable?- Specified by:
isReadOnlyin interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- true - vti's are read only false - column is not read-only
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
isWritable
public boolean isWritable(int column) throws java.sql.SQLExceptionIs it possible for a write on the column to succeed?- Specified by:
isWritablein interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- true if column is possibly writable
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
isDefinitelyWritable
public boolean isDefinitelyWritable(int column) throws java.sql.SQLExceptionWill a write on the column definitely succeed?- Specified by:
isDefinitelyWritablein interfacejava.sql.ResultSetMetaData- Parameters:
column- the first column is 1, the second is 2, ...- Returns:
- true if column is definitely writable
- Throws:
java.sql.SQLException- if a database-access error occurs.
-
getColumnClassName
public java.lang.String getColumnClassName(int column) throws java.sql.SQLExceptionReturns the fully-qualified name of the Java class whose instances are manufactured if the methodResultSet.getObjectis called to retrieve a value from the column. JDBC 2.0.- Specified by:
getColumnClassNamein interfacejava.sql.ResultSetMetaData- Throws:
java.sql.SQLException- if a database-access error occurs
-
notImplemented
protected java.sql.SQLException notImplemented(java.lang.String methodName)
Create a SQLException saying that the calling method is not implemented.
-
-