query
Class Catalog

java.lang.Object
  extended by query.Catalog
All Implemented Interfaces:
GlobalConst

public class Catalog
extends java.lang.Object
implements GlobalConst

Minibase System Catalog

Maintains metadata about every table, column, and index in the database; this information itself is stored in tables (i.e. heap files).


Field Summary
 
Fields inherited from interface global.GlobalConst
EMPTY_SLOT, FIRST_PAGEID, INVALID_PAGEID, MAX_COLSIZE, MAX_TUPSIZE, NAME_MAXLEN, PAGE_SIZE, PIN_DISKIO, PIN_MEMCPY, UNPIN_CLEAN, UNPIN_DIRTY
 
Constructor Summary
Catalog(boolean exists)
          Opens the system catalog if it exists, otherwise initializes an empty one.
 
Method Summary
 void createIndex(java.lang.String fileName, java.lang.String ixTable, java.lang.String ixColumn)
          Adds a newly created index to the catalog.
 void createTable(java.lang.String fileName, Schema schema)
          Adds a newly created table to the catalog.
 void dropIndex(java.lang.String fileName)
          Removes an existing index from the catalog.
 void dropTable(java.lang.String fileName)
          Removes an existing table from the catalog.
 RID getFileRID(java.lang.String fileName, boolean isTable)
          Gets the RID of the file's catalog entry, or null if it doesn't exist.
 IndexDesc[] getIndexes(java.lang.String fileName)
          Gets any indexes on a given table.
 IndexDesc[] getIndexes(java.lang.String fileName, Schema schema, int[] fldnos)
          Gets any indexes on a given set of columns.
 Schema getSchema(java.lang.String fileName)
          Gets the Schema for the given table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Catalog

public Catalog(boolean exists)
Opens the system catalog if it exists, otherwise initializes an empty one.

Parameters:
exists - true if the catalog tables already exist, false otherwise
Method Detail

getFileRID

public RID getFileRID(java.lang.String fileName,
                      boolean isTable)
Gets the RID of the file's catalog entry, or null if it doesn't exist.

Parameters:
fileName - name of the table/index file
isTable - true if a table, false if an index

createTable

public void createTable(java.lang.String fileName,
                        Schema schema)
Adds a newly created table to the catalog.


getSchema

public Schema getSchema(java.lang.String fileName)
Gets the Schema for the given table.


dropTable

public void dropTable(java.lang.String fileName)
Removes an existing table from the catalog.


createIndex

public void createIndex(java.lang.String fileName,
                        java.lang.String ixTable,
                        java.lang.String ixColumn)
Adds a newly created index to the catalog.


getIndexes

public IndexDesc[] getIndexes(java.lang.String fileName)
Gets any indexes on a given table.


getIndexes

public IndexDesc[] getIndexes(java.lang.String fileName,
                              Schema schema,
                              int[] fldnos)
Gets any indexes on a given set of columns.


dropIndex

public void dropIndex(java.lang.String fileName)
Removes an existing index from the catalog.