|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.jdbw.metadata.Table
public class Table
Table is the primary object you deal with in a database server, they contain at least one column (often more) making the definition of the table and 0 or more rows, which each row has a value for each column.
A table normally has a primary key, a kind of unique index where each row has a value that is unique for within this table. This primary key consists of at least (and normally) one column but could be a combination of several. If you look for a particular row in the table and you know the value of the primary key column(s), this row can be fetched very quickly.
Other than a primary key, a table may also have one or more indexes.
An index will make certain lookups much more efficient, you can find more
information about how this works in the description of the Index class.
Schema,
Column,
Index| Constructor Summary | |
|---|---|
Table(MetaDataResolver metaDataResolver,
Schema schema,
String tableName)
|
|
| Method Summary | |
|---|---|
int |
compareTo(Table o)
|
List<Index> |
getAllIndexes()
|
Catalog |
getCatalog()
|
Column |
getColumn(int columnIndex)
Retrieves a column by index the database |
Column |
getColumn(String columnName)
Looks up one column |
Map<String,Column> |
getColumnMap()
|
List<Column> |
getColumns()
|
Map<String,Index> |
getIndexMap()
|
String |
getName()
|
int |
getNrOfColumns()
|
Index |
getPrimaryKey()
|
Schema |
getSchema()
|
Index |
getUniqueKey()
This method will return you the primary key if there is one, otherwise scan through the list of indexes and return the first available unique index. |
void |
invalidateCache()
This table class will cache the columns and indexes after reading them from the database server once, this method will clear the cache, forcing them to be re-read. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Table(MetaDataResolver metaDataResolver,
Schema schema,
String tableName)
| Method Detail |
|---|
public Catalog getCatalog()
public String getName()
public Schema getSchema()
public Index getUniqueKey()
throws SQLException
SQLException - In an error occurred while reading information from
the database
public Index getPrimaryKey()
throws SQLException
Index
or null if there is no primary key
SQLException - In an error occurred while reading information from
the databasepublic void invalidateCache()
public List<Column> getColumns()
throws SQLException
SQLException - In an error occurred while reading information from
the database
public List<Index> getAllIndexes()
throws SQLException
SQLException - In an error occurred while reading information from
the database
public Column getColumn(String columnName)
throws SQLException
columnName - Name of the column to retrieve
Column representing the column or null if there
was no column by this name in the table
SQLException - In an error occurred while reading information from
the database
public Column getColumn(int columnIndex)
throws SQLException
columnIndex - Index of the column (starting from 0)
SQLException - In an error occurred while reading information from
the database
public int getNrOfColumns()
throws SQLException
SQLException - In an error occurred while reading information from
the databasepublic int compareTo(Table o)
compareTo in interface Comparable<Table>
public Map<String,Column> getColumnMap()
throws SQLException
Column object) of all columns in this
table
SQLException - In an error occurred while reading information from
the database
public Map<String,Index> getIndexMap()
throws SQLException
Index object) of all indexes in this
table, including the primary key
SQLException - In an error occurred while reading information from
the databasepublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||