public class Table extends Object
Constructor and Description |
---|
Table(String name)
Constructs a Table object with the specified name.
|
Modifier and Type | Method and Description |
---|---|
void |
addColumn(Column c)
Adds a column to the list of columns for this table.
|
static void |
cacheClose()
Closes the in-memory cache of open tables, which closes all
the BDB database handles for the open tables.
|
static void |
cacheInit()
Initializes the in-memory cache of open tables.
|
void |
close()
Closes the table and ensures all changes have been written to disk.
|
String |
dbName()
Returns the name of the table's BDB database file.
|
Column |
getColumn(int i)
Returns the column with the specified index in this table.
|
Database |
getDB()
Returns the database handle for this table's underlying database.
|
String |
getName()
Returns the name of the table.
|
String |
getRangeVar()
Returns the range variable (if any) associated with this table.
|
int |
numColumns()
Returns the number of columns in this table.
|
OperationStatus |
open()
Opens the table so that it can be accessed by SQL commands.
|
Column |
primaryKeyColumn()
Returns the column (if any) that is the primary key of this table.
|
void |
setDB(Database db)
Sets the database handle for this table's underlying database.
|
void |
setRangeVariable(String r)
Sets a range variable (i.e., an alias) for this table.
|
String |
toString() |
public Table(String name)
name
- the name of the tablepublic OperationStatus open() throws DatabaseException
OperationStatus.NOTFOUND
if the table does
not exist, and OperationStatus.SUCCESS
otherwise.DatabaseException
- if Berkeley DB encounters a problem opening
the underlying database.public void close() throws DatabaseException
Table.cacheClose()
method is invoked to close
all tables, it is not necessary to call this method as well.DatabaseException
- if Berkeley DB encounters a problem closing
the underlying database.public Column primaryKeyColumn()
RuntimeException
- if the table object does not have any
columns associated with itpublic String dbName()
public String getName()
public String getRangeVar()
public Database getDB()
public Column getColumn(int i)
RuntimeException
- if the table object does not have any
columns associated with itIndexOutOfBoundsException
- if the specified index is invalidpublic int numColumns()
public void setRangeVariable(String r)
r
- the range variablepublic void addColumn(Column c)
c
- the columnpublic void setDB(Database db)
db
- the database handlepublic static void cacheInit()
public static void cacheClose() throws DatabaseException
DatabaseException
- if Berkeley DB encounters a problem
while closing a database handle