Class DBMetaData

java.lang.Object
com.compomics.util.db.DBMetaData

public class DBMetaData
extends Object
This class wraps the metadata retrieved from a table on the DB.
Author:
Lennart Martens
  • Constructor Details

    • DBMetaData

      public DBMetaData()
      Empty default constructor
    • DBMetaData

      public DBMetaData​(String aTable, String[] aColumns, int[] aColTypes, int[] aColSizes)
      Constructor that allows the specification of table name, column names and column types.
      Parameters:
      aTable - String with the table name
      aColumns - String[] with the column names
      aColTypes - int[] with the coded column types
      aColSizes - int[] with the column sizes
    • DBMetaData

      public DBMetaData​(String aTable, String[] aColumns, int[] aColTypes, int[] aColSizes, String[] aPKColumns)
      Constructor that allows the specification of table name, column names and column types and the primary key columns..
      Parameters:
      aTable - String with the table name
      aColumns - String[] with the column names
      aColTypes - int[] with the coded column types
      aColSizes - int[] with the column sizes
      aPKColumns - String[] with the names for the primary key columns.
    • DBMetaData

      public DBMetaData​(String aTable, Vector aColumns, Vector aColTypes, Vector aColSizes)
      Constructor that allows the specification of table name, column names and column types.
      Parameters:
      aTable - String with the table name
      aColumns - Vector with the column names (should contain only Strings)
      aColTypes - Vector with the coded column types (should contain only Integers)
      aColSizes - Vector with the column sizes (should contain only integers).
    • DBMetaData

      public DBMetaData​(String aTable, Vector aColumns, Vector aColTypes, Vector aColSizes, Vector aPKColumns)
      Constructor that allows the specification of table name, column names, column types, column sizes and the primary key columns.
      Parameters:
      aTable - String with the table name
      aColumns - Vector with the column names (should contain only Strings)
      aColTypes - Vector with the coded column types (should contain only Integers)
      aColSizes - Vector with the column sizes (should contain only integers).
      aPKColumns - Vector with the names for the primary key columns.
  • Method Details

    • getTableName

      public String getTableName()
      This method reports on the tablename.
      Returns:
      String with the tablename.
    • getColumnNames

      public String[] getColumnNames()
      This method reports on all the column names.
      Returns:
      String[] with all the column names.
    • getCodedColumnTypes

      public int[] getCodedColumnTypes()
      This method reports on all the coded column types.
      Returns:
      int[] with all the coded column types.
    • getColumnSizes

      public int[] getColumnSizes()
      This method reports on all the column sizes.
      Returns:
      int[] with all the column sizes.
    • getConvertedColumnTypes

      public String[] getConvertedColumnTypes()
      This method reports on all the converted column types.
      Returns:
      String[] with all the converted column types.
    • getColumnCount

      public int getColumnCount()
      This method returns the column count for this table.
      Returns:
      int with the column count.
    • getColumnName

      public String getColumnName​(int aColumnIndex)
      This method returns the name of the specified column.
      Parameters:
      aColumnIndex - int with the index of the column for which to retrieve the name.
      Returns:
      String with the columnname, or 'null' if the specified index was out of bounds.
    • getCodedColumnType

      public int getCodedColumnType​(String aColumnName)
      This method returns the coded column type for the specified column.
      Parameters:
      aColumnName - String with the column name.
      Returns:
      int with the coded column type for the specified column, or '-1' if the specified column was not found.
    • getColumnSize

      public int getColumnSize​(String aColumnName)
      This method returns the column size for the specified column.
      Parameters:
      aColumnName - String with the column name.
      Returns:
      int with the column size for the specified column, or '-1' if the specified column was not found.
    • getConvertedColumnType

      public String getConvertedColumnType​(String aColumnName)
      This method returns the converted column type for the specified column.
      Parameters:
      aColumnName - String with the column name.
      Returns:
      String with the converted column type for the specified column, or 'null' if the specified column was not found.
    • getCodedColumnType

      public int getCodedColumnType​(int aColumnIndex)
      This method returns the coded columntype for the specified column index.
      Parameters:
      aColumnIndex - int with the column index
      Returns:
      int with the coded column type for the specified column, or '-1' if the specified index went out of range.
    • getColumnSize

      public int getColumnSize​(int aColumnIndex)
      This method returns the column size for the specified column index.
      Parameters:
      aColumnIndex - int with the column index
      Returns:
      int with the column size for the specified column, or '-1' if the specified index went out of range.
    • getConvertedColumnType

      public String getConvertedColumnType​(int aColumnIndex)
      This method returns the converted columntype for the specified column index.
      Parameters:
      aColumnIndex - int with the column index
      Returns:
      String with the converted column type for the specified column, or 'null' if the specified index went out of range.
    • getPrimaryKeyColumns

      public String[] getPrimaryKeyColumns()
      This method reports on the primary key columns for the table.
      Returns:
      String[] with the names of the primary key columns.
    • toString

      public String toString()
      This method presents a String representation for this object.
      Overrides:
      toString in class Object
      Returns:
      String with the String representation for this object.