java.lang.Object
org.tentackle.sql.metadata.ColumnMetaData
- Direct Known Subclasses:
MySqlColumnMetaData,OracleColumnMetaData,PostgresColumnMetaData
Meta data for a column
- Author:
- harald
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the columnName of the column.Gets the comment.Gets the column's default.intgetScale()Gets the numeric scale.intgetSize()Gets the column's size.Gets the table metadata.intgetType()Gets the column's type.Gets the backend-specific type columnName.booleanReturns whether column is nullable.booleanmatchesSqlType(SqlType sqlType) Checks whether colunm's type matches given SqlType according to the backend.voidsetColumnName(String columnName) Sets the column name.voidsetComment(String comment) Sets the comment.voidsetDefaultValue(String defaultValue) Sets the default value.voidsetNullable(boolean nullable) Sets whether column is nullable.voidsetScale(int scale) Sets the scale.voidsetSize(int size) Sets the size.voidsetType(int type) Sets the type.voidsetTypeName(String typeName) Sets the type name.voidsetupColumnFromMetaData(ResultSet resultSet) Sets up the column from the database metadata result.toString()voidvalidate()Validates and post-processes the column data.
-
Constructor Details
-
ColumnMetaData
Creates column meta data.- Parameters:
tableMetaData- the table metadata this column belongs to
-
-
Method Details
-
getTableMetaData
Gets the table metadata.- Returns:
- the table this column belongs to
-
setupColumnFromMetaData
Sets up the column from the database metadata result.- Parameters:
resultSet- the column result set- Throws:
SQLException- the processing the result set failed
-
getColumnName
Gets the columnName of the column.- Returns:
- the columnName (always in lowercase)
-
setColumnName
Sets the column name.- Parameters:
columnName- the column name
-
getComment
Gets the comment.- Returns:
- the comment, null if none
-
setComment
Sets the comment.- Parameters:
comment- the comment
-
getType
public int getType()Gets the column's type.- Returns:
- the type
- See Also:
-
setType
public void setType(int type) Sets the type.- Parameters:
type- the type
-
getTypeName
Gets the backend-specific type columnName.- Returns:
- the type columnName
-
setTypeName
Sets the type name.- Parameters:
typeName- the type name
-
getSize
public int getSize()Gets the column's size.- Returns:
- the size
-
setSize
public void setSize(int size) Sets the size.- Parameters:
size- the size
-
getScale
public int getScale()Gets the numeric scale.- Returns:
- the scale
-
setScale
public void setScale(int scale) Sets the scale.- Parameters:
scale- the scale
-
getDefaultValue
Gets the column's default.- Returns:
- the default value
-
setDefaultValue
Sets the default value.- Parameters:
defaultValue- the default value
-
isNullable
public boolean isNullable()Returns whether column is nullable.- Returns:
- true if nullable
-
setNullable
public void setNullable(boolean nullable) Sets whether column is nullable.- Parameters:
nullable- true if nullable
-
matchesSqlType
Checks whether colunm's type matches given SqlType according to the backend.- Parameters:
sqlType- the sqltype- Returns:
- true if matches
-
validate
public void validate()Validates and post-processes the column data. -
toString
-