|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectsimpledb.Catalog
public class Catalog
The Catalog keeps track of all available tables in the database and their associated schemas. For now, this is a stub catalog that must be populated with tables by a user program before it can be used -- eventually, this should be converted to a catalog that reads a catalog table from disk.
| Constructor Summary | |
|---|---|
Catalog()
Constructor. |
|
| Method Summary | |
|---|---|
void |
addTable(DbFile file)
Add a new table to the catalog. |
void |
addTable(DbFile file,
java.lang.String name)
|
void |
addTable(DbFile file,
java.lang.String name,
java.lang.String pkeyField)
Add a new table to the catalog. |
void |
clear()
Delete all tables from the catalog |
DbFile |
getDbFile(int tableid)
Returns the DbFile that can be used to read the contents of the specified table. |
java.lang.String |
getPrimaryKey(int tableid)
|
int |
getTableId(java.lang.String name)
Return the id of the table with a specified name, |
java.lang.String |
getTableName(int id)
|
TupleDesc |
getTupleDesc(int tableid)
Returns the tuple descriptor (schema) of the specified table |
void |
loadSchema(java.lang.String catalogFile)
Reads the schema from a file and creates the appropriate tables in the database. |
java.util.Iterator<java.lang.Integer> |
tableIdIterator()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Catalog()
| Method Detail |
|---|
public void addTable(DbFile file,
java.lang.String name,
java.lang.String pkeyField)
file - the contents of the table to add; file.getId() is the identfier of
this file/tupledesc param for the calls getTupleDesc and getFilename - the name of the table -- may be an empty string. May not be null. If a namepkeyField - the name of the primary key field
conflict exists, use the last table to be added as the table for a given name.
public void addTable(DbFile file,
java.lang.String name)
public void addTable(DbFile file)
file - the contents of the table to add; file.getId() is the identfier of
this file/tupledesc param for the calls getTupleDesc and getFile
public int getTableId(java.lang.String name)
throws java.util.NoSuchElementException
java.util.NoSuchElementException - if the table doesn't exist
public TupleDesc getTupleDesc(int tableid)
throws java.util.NoSuchElementException
tableid - The id of the table, as specified by the DbFile.getId()
function passed to addTable
java.util.NoSuchElementException - if the table doesn't exist
public DbFile getDbFile(int tableid)
throws java.util.NoSuchElementException
tableid - The id of the table, as specified by the DbFile.getId()
function passed to addTable
java.util.NoSuchElementExceptionpublic java.lang.String getPrimaryKey(int tableid)
public java.util.Iterator<java.lang.Integer> tableIdIterator()
public java.lang.String getTableName(int id)
public void clear()
public void loadSchema(java.lang.String catalogFile)
catalogFile -
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||