public class ColumnMetaDataImpl extends Object implements ColumnMetaData
Constructor and Description |
---|
ColumnMetaDataImpl() |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ColumnMetaData column)
Compares another column based on the column number of the select clause in the SQL Resource definition query.
|
String |
getColumnLabel()
Returns column label, a string identified in double quotes after columns in the select clause in the SQL Resource
definition query.
|
String |
getColumnName()
Returns column name, as it is known by the database.
|
int |
getColumnNumber()
Returns column number in the select clause in the SQL Resource definition query.
|
int |
getColumnType()
Returns column type from java.sql.Types.
|
protected int |
getColumnType(int columnType,
String columnTypeName)
Method for subclasses to customize column type if desired.
|
String |
getColumnTypeName()
Returns column type name as given by the database JDBC driver.
|
String |
getDatabaseName()
Returns database name.
|
String |
getQualifiedColumnLabel()
Returns fully qualified column label in database-specific form for use in SQL statements.
|
String |
getQualifiedColumnName()
Returns fully qualified column name in database-specific form for use in SQL statements.
|
String |
getQualifiedTableName()
Returns fully qualified table name in database-specific form for use in SQL statements.
|
Object |
getResultByLabel(ResultSet resultSet)
Returns object from result set using the column label.
|
Object |
getResultByNumber(ResultSet resultSet)
Returns object from result set using the column number.
|
String |
getSequenceName()
Returns sequence name associated with column or null if none.
|
String |
getTableName()
Returns table name.
|
TableMetaData.TableRole |
getTableRole()
Returns role of table in the SQL Resource.
|
boolean |
isBinaryType()
Returns true if type is BINARY, BLOB, JAVA OBJECT or LONGVARBINARY.
|
boolean |
isCharOrDateTimeType()
Returns true if column is a character string or date, time or timestamp.
|
boolean |
isNonqueriedForeignKey()
Returns true for foreign key columns not declared in the SQL Resource query but added by the framework.
|
boolean |
isPrimaryKey()
Returns true if the column is a primary key.
|
boolean |
isReadOnly()
Returns true if the column is read-only, for example derived from SQL function or a database view.
|
boolean |
isSequence()
Returns true if column is associated with a sequence.
|
void |
normalizeValue(RequestValue requestValue)
Converts String value to a numeric Object, Date or UUDecode String into Object if required using the column
metadata.
|
void |
setAttributes(int columnNumber,
String databaseName,
String qualifiedTableName,
String tableName,
String columnName,
String qualifiedColumnName,
String columnLabel,
String qualifiedColumnLabel,
String columnTypeName,
int columnType,
boolean readOnly)
Used for all columns declared in the SqlResource select clause.
|
void |
setAttributes(String databaseName,
String sqlQualifiedTableName,
String tableName,
TableMetaData.TableRole tableRole,
String columnName,
String qualifiedColumnName,
String columnLabel,
String qualifiedColumnLabel,
String columnTypeString)
Used for foreign key columns not declared in the SqlResource select columns.
|
void |
setPrimaryKey(boolean primaryKey)
Sets primary key.
|
void |
setSequence(boolean sequence)
Sets true if column populated with a sequence function (auto increment).
|
void |
setSequenceName(String sequenceName)
Sets sequence name.
|
void |
setTableRole(TableMetaData.TableRole tableRole)
Sets table role.
|
public int compareTo(ColumnMetaData column)
ColumnMetaData
compareTo
in interface Comparable<ColumnMetaData>
compareTo
in interface ColumnMetaData
public String getColumnLabel()
ColumnMetaData
getColumnLabel
in interface ColumnMetaData
public String getColumnName()
ColumnMetaData
getColumnName
in interface ColumnMetaData
public int getColumnNumber()
ColumnMetaData
getColumnNumber
in interface ColumnMetaData
public int getColumnType()
ColumnMetaData
getColumnType
in interface ColumnMetaData
Types
public String getColumnTypeName()
ColumnMetaData
getColumnTypeName
in interface ColumnMetaData
public String getDatabaseName()
ColumnMetaData
getDatabaseName
in interface ColumnMetaData
public String getQualifiedColumnLabel()
ColumnMetaData
database.table.label
, for example sakila.film.id
. PostgreSQL can only use
label
and cannot disambiguate by table source.getQualifiedColumnLabel
in interface ColumnMetaData
public String getQualifiedColumnName()
ColumnMetaData
database.table.column
, for example sakila.film.film_id
. PostgreSQL uses the form
database.schema.table.column
, for example sakila.public.film.film_id
.getQualifiedColumnName
in interface ColumnMetaData
public String getQualifiedTableName()
ColumnMetaData
database.table
, for example sakila.film
. PostgreSQL uses the form
database.schema.table
, for example sakila.public.film
.getQualifiedTableName
in interface ColumnMetaData
public Object getResultByLabel(ResultSet resultSet) throws SQLException
ColumnMetaData
getResultByLabel
in interface ColumnMetaData
SQLException
public Object getResultByNumber(ResultSet resultSet) throws SQLException
ColumnMetaData
getResultByNumber
in interface ColumnMetaData
SQLException
public String getSequenceName()
ColumnMetaData
getSequenceName
in interface ColumnMetaData
public String getTableName()
ColumnMetaData
getTableName
in interface ColumnMetaData
public TableMetaData.TableRole getTableRole()
ColumnMetaData
getTableRole
in interface ColumnMetaData
public boolean isBinaryType()
ColumnMetaData
isBinaryType
in interface ColumnMetaData
public boolean isCharOrDateTimeType()
ColumnMetaData
isCharOrDateTimeType
in interface ColumnMetaData
public boolean isNonqueriedForeignKey()
ColumnMetaData
isNonqueriedForeignKey
in interface ColumnMetaData
public boolean isPrimaryKey()
ColumnMetaData
isPrimaryKey
in interface ColumnMetaData
public boolean isReadOnly()
ColumnMetaData
isReadOnly
in interface ColumnMetaData
public boolean isSequence()
ColumnMetaData
isSequence
in interface ColumnMetaData
ColumnMetaData.getSequenceName()
public void normalizeValue(RequestValue requestValue) throws InvalidRequestException
ColumnMetaData
normalizeValue
in interface ColumnMetaData
requestValue
- parameter or resource identifierInvalidRequestException
- if conversion failedpublic void setAttributes(int columnNumber, String databaseName, String qualifiedTableName, String tableName, String columnName, String qualifiedColumnName, String columnLabel, String qualifiedColumnLabel, String columnTypeName, int columnType, boolean readOnly)
setAttributes
in interface ColumnMetaData
public void setAttributes(String databaseName, String sqlQualifiedTableName, String tableName, TableMetaData.TableRole tableRole, String columnName, String qualifiedColumnName, String columnLabel, String qualifiedColumnLabel, String columnTypeString)
setAttributes
in interface ColumnMetaData
public void setPrimaryKey(boolean primaryKey)
ColumnMetaData
setPrimaryKey
in interface ColumnMetaData
public void setSequence(boolean sequence)
ColumnMetaData
setSequence
in interface ColumnMetaData
public void setSequenceName(String sequenceName)
ColumnMetaData
setSequenceName
in interface ColumnMetaData
public void setTableRole(TableMetaData.TableRole tableRole)
ColumnMetaData
setTableRole
in interface ColumnMetaData
Copyright © 2011-2018 restSQL Project Contributors