Package com.compomics.util.db
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 Summary
Constructors Constructor Description DBMetaData()
Empty default constructorDBMetaData(String aTable, String[] aColumns, int[] aColTypes, int[] aColSizes)
Constructor that allows the specification of table name, column names and column types.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..DBMetaData(String aTable, Vector aColumns, Vector aColTypes, Vector aColSizes)
Constructor that allows the specification of table name, column names and column types.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. -
Method Summary
Modifier and Type Method Description int
getCodedColumnType(int aColumnIndex)
This method returns the coded columntype for the specified column index.int
getCodedColumnType(String aColumnName)
This method returns the coded column type for the specified column.int[]
getCodedColumnTypes()
This method reports on all the coded column types.int
getColumnCount()
This method returns the column count for this table.String
getColumnName(int aColumnIndex)
This method returns the name of the specified column.String[]
getColumnNames()
This method reports on all the column names.int
getColumnSize(int aColumnIndex)
This method returns the column size for the specified column index.int
getColumnSize(String aColumnName)
This method returns the column size for the specified column.int[]
getColumnSizes()
This method reports on all the column sizes.String
getConvertedColumnType(int aColumnIndex)
This method returns the converted columntype for the specified column index.String
getConvertedColumnType(String aColumnName)
This method returns the converted column type for the specified column.String[]
getConvertedColumnTypes()
This method reports on all the converted column types.String[]
getPrimaryKeyColumns()
This method reports on the primary key columns for the table.String
getTableName()
This method reports on the tablename.String
toString()
This method presents a String representation for this object.
-
Constructor Details
-
DBMetaData
public DBMetaData()Empty default constructor -
DBMetaData
Constructor that allows the specification of table name, column names and column types.- Parameters:
aTable
- String with the table nameaColumns
- String[] with the column namesaColTypes
- int[] with the coded column typesaColSizes
- 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 nameaColumns
- String[] with the column namesaColTypes
- int[] with the coded column typesaColSizes
- int[] with the column sizesaPKColumns
- String[] with the names for the primary key columns.
-
DBMetaData
Constructor that allows the specification of table name, column names and column types.- Parameters:
aTable
- String with the table nameaColumns
- 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 nameaColumns
- 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
This method reports on the tablename.- Returns:
- String with the tablename.
-
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
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
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
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
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
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
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
This method reports on the primary key columns for the table.- Returns:
- String[] with the names of the primary key columns.
-
toString
This method presents a String representation for this object.
-