Class ColumnMetaData

java.lang.Object
org.tentackle.sql.metadata.ColumnMetaData
Direct Known Subclasses:
MySqlColumnMetaData, OracleColumnMetaData, PostgresColumnMetaData

public class ColumnMetaData extends Object
Meta data for a column
Author:
harald
  • Constructor Details

    • ColumnMetaData

      public ColumnMetaData(TableMetaData tableMetaData)
      Creates column meta data.
      Parameters:
      tableMetaData - the table metadata this column belongs to
  • Method Details

    • getTableMetaData

      public TableMetaData getTableMetaData()
      Gets the table metadata.
      Returns:
      the table this column belongs to
    • setupColumnFromMetaData

      public void setupColumnFromMetaData(ResultSet resultSet) throws SQLException
      Sets up the column from the database metadata result.
      Parameters:
      resultSet - the column result set
      Throws:
      SQLException - the processing the result set failed
    • getColumnName

      public String getColumnName()
      Gets the columnName of the column.
      Returns:
      the columnName (always in lowercase)
    • setColumnName

      public void setColumnName(String columnName)
      Sets the column name.
      Parameters:
      columnName - the column name
    • getComment

      public String getComment()
      Gets the comment.
      Returns:
      the comment, null if none
    • setComment

      public void setComment(String comment)
      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

      public String getTypeName()
      Gets the backend-specific type columnName.
      Returns:
      the type columnName
    • setTypeName

      public void setTypeName(String typeName)
      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

      public String getDefaultValue()
      Gets the column's default.
      Returns:
      the default value
    • setDefaultValue

      public void setDefaultValue(String defaultValue)
      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

      public boolean matchesSqlType(SqlType sqlType)
      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

      public String toString()
      Overrides:
      toString in class Object