Quadcap Embeddable Database

com.quadcap.sql.Database Class Reference

Inheritance diagram for com.quadcap.sql.Database:

Datafile List of all members.

Detailed Description

This class implements the QED SQL database outer API.

Author:
Stan Bailes

Definition at line 86 of file Database.java.

Public Member Functions

 Database ()
 Constructor.

void init (QDriver driver, String url, String fileName, Properties props) throws IOException, SQLException
void createRoot (String fileName, Properties props) throws IOException
 Create a new root block.

void readRoot () throws IOException
 Read the root block from an existing database.

void flushRoot () throws IOException
 Write the database root.

void bootFromRoot (boolean restart) throws IOException
 Get ready to rumble!!!

long getNextTransId () throws IOException
 Return the next available transaction ID.

void maybeBackup () throws IOException
 Figure out if it's time to do a backup.

void addIndex (String indexName, String tableName) throws IOException
 TODO: XXX Unicode!!! Add a new named index for the specified table.

String getTableForIndex (String indexName) throws IOException
 Return the table for the index of the specified name.

void deleteIndex (String indexName) throws IOException
 Remove the specified index.

long getTableIdentity (String name) throws IOException, SQLException
 Return the table identity for the table.

void updateTableIdentity (String name, long num) throws IOException, SQLException
 The "table identity" is a long value stored along with the table stream pointer, so that it can easily be updated as long as the index is in memory, without touching any data pages.

java.sql.ResultSet execute (String sql) throws SQLException, IOException
 Helper to execute a single SQL statement (in its own connection) and return a result set.

java.sql.ResultSet execute (Session session, String sql) throws IOException, SQLException
 Helper to execute a single SQL statement for the given session.

Relation getRelation (String name) throws IOException
 Return the table/view with the specified name.

void addRelation (Relation table) throws IOException, SQLException
 Add a new table/view '.

void removeRelation (String name) throws IOException, SQLException
 Delete the specified table/view.

void renameRelation (Relation r, String newN) throws IOException
 Rename a relation.

void updateRelation (Relation table) throws IOException
 Store a modified version of the specified view/table to the store.

void addViewDependency (String base, String view) throws IOException
 Establish the dependency link between a view and a base table.

void checkViewDependency (String base, String view) throws SQLException, IOException
 Make sure that the specified view dependency is valid.

Enumeration getViews (String base) throws IOException
 Return an enumeration of all views for the specified base table.

Enumeration getBases (String view) throws IOException
 Return an enumeration containing all base tables for the specified view.

void removeViewDependencies (String view) throws SQLException, IOException
Iterator getRelationNameIterator () throws IOException
 This hacky crack of encapsulation is for sql.meta.MetaTables, to support DatabaseMetaData.getTables().

int addConnection ()
 Add a new connection (just remember the count...).

QDriver getDriver ()
 Sleight of hand to get my driver interface.

void removeConnection ()
 Remove a connection.

int getConnectionCount ()
 Return the number of active connections.

String getBackupDir ()
 Return the backup directory name.

void setBackupDir (String str) throws IOException
 Set the backup directory.

int getBackupCount ()
 Return the backup count.

void setBackupCount (int count) throws IOException
 Set the backup count.

int getBackupDays ()
 Return the backup days.

void setBackupDays (int count) throws IOException
 Set the backup days.

int getBackupLastDay ()
 Return the backup last day.

void setBackupLastDay (int day) throws IOException
 Set the backup last day.

int getBackupTime ()
 Return the backup time.

void setBackupTime (int time) throws IOException
 Set the backup time.

String getBackupFormat ()
 Return the backup format.

void setBackupFormat (String str) throws IOException
 Set the backup format.

void checkAuth (String user, String passwd) throws SQLException
 Check the specified authentication credentials; throw an exception if authorization shouldn't be granted.

int getPermBlobRefCount (long blob) throws IOException
 Return the current persistent refcount for the specified blob.

int refCountBlob (long transId, long blob, int incr) throws IOException
void addMorgue (long blob, long transId)
 Add a blob/clob to the morgue.

void delMorgue (long blob)
 Remove a blob/clob from the morgue.

LongIterator enumerateMorgue ()
 Enumerate the morgue.

void checkpointHandler (LongMap activeTransactions) throws IOException
 Called during a checkpoint operation.

void emptyMorgue (LongMap activeTransactions) throws IOException
 Empty the BLOB morgue.

void display (PrintWriter w) throws IOException
long putRow (Session session, BlockFile f, Tuple t, Row row) throws SQLException, IOException
 Convenience method to write a new row to the database.

final void putRow (Session session, Tuple t, long rowId, Row row) throws SQLException, IOException
 Convenience method to update a table row.

void getRow (long rowId, LazyRow row, boolean isTemp) throws IOException, SQLException
void removeRow (long rowId) throws IOException
void removeRow (BlockFile file, long rowId) throws IOException
boolean inMemory ()

Public Attributes

DatabaseRoot nroot
Object driverLock

Package Functions

File makeBackupFile (int n) throws IOException
void renameIndexedTable (String oldN, String newN) throws IOException
 RENAME TABLE percolates into the index index...

final Session getSession (Transaction t) throws IOException, SQLException

Package Attributes

QDriver driver
Btree tableIndex
Btree indexIndex
Btree blobPermRefCounts
Map tableMap = new HashMap()
MultiSet forwardDeps = null
MultiSet reverseDeps = null
long rootBlock = 0
LongMap blobMorgue = new LongMap(32)
 The Morgue; BLOB/CLOBs with zero (persistent) refcounts: blobRef -> any.

LongMap blobActivity = new LongMap(128)
 Map blob -> Vector<transid>.

int connectionCount = 0
int closeCount = 0
long nextTransId = 0
Session zSession = null
Connection zConn = null

Static Package Attributes

final ConfigString backupClass

Private Attributes

byte[] key = new byte[8]


Constructor & Destructor Documentation

com.quadcap.sql.Database.Database  ) 
 

Constructor.

Definition at line 118 of file Database.java.


Member Function Documentation

int com.quadcap.sql.Database.addConnection  ) 
 

Add a new connection (just remember the count...).

Definition at line 756 of file Database.java.

References com.quadcap.sql.Database.connectionCount, and com.quadcap.sql.Database.driverLock.

Referenced by com.quadcap.jdbc.JdbcDriver.connect().

void com.quadcap.sql.Database.addIndex String  indexName,
String  tableName
throws IOException
 

TODO: XXX Unicode!!! Add a new named index for the specified table.

Definition at line 261 of file Database.java.

References com.quadcap.sql.Database.addIndex(), and com.quadcap.sql.Database.indexIndex.

Referenced by com.quadcap.sql.Database.addIndex(), com.quadcap.sql.AddConstraint.redo(), and com.quadcap.sql.DeleteConstraint.undo().

void com.quadcap.sql.Database.addMorgue long  blob,
long  transId
 

Add a blob/clob to the morgue.

Definition at line 963 of file Database.java.

References com.quadcap.sql.Database.addMorgue(), and com.quadcap.sql.Database.blobMorgue.

Referenced by com.quadcap.sql.Database.addMorgue(), and com.quadcap.sql.Database.refCountBlob().

void com.quadcap.sql.Database.addRelation Relation  table  )  throws IOException, SQLException
 

Add a new table/view '.

Definition at line 444 of file Database.java.

References com.quadcap.sql.Database.addRelation(), com.quadcap.sql.Tuple.getName(), com.quadcap.sql.Database.inMemory(), com.quadcap.sql.index.BCursor.insert(), com.quadcap.sql.index.BCursor.release(), com.quadcap.sql.index.BCursor.seek(), com.quadcap.sql.Database.tableIndex, and com.quadcap.sql.Database.tableMap.

Referenced by com.quadcap.sql.Database.addRelation(), com.quadcap.sql.StmtCreateView.redo(), com.quadcap.sql.AddTable.redo(), and com.quadcap.sql.DropTable.undo().

void com.quadcap.sql.Database.addViewDependency String  base,
String  view
throws IOException
 

Establish the dependency link between a view and a base table.

Definition at line 587 of file Database.java.

References com.quadcap.sql.Database.addViewDependency(), com.quadcap.sql.Database.forwardDeps, com.quadcap.sql.MultiSet.put(), and com.quadcap.sql.Database.reverseDeps.

Referenced by com.quadcap.sql.Database.addViewDependency(), com.quadcap.sql.StmtCreateView.redo(), and com.quadcap.sql.DropTable.undo().

void com.quadcap.sql.Database.bootFromRoot boolean  restart  )  throws IOException
 

Get ready to rumble!!!

Definition at line 163 of file Database.java.

References com.quadcap.sql.Database.blobPermRefCounts, com.quadcap.sql.Database.bootFromRoot(), com.quadcap.sql.Database.forwardDeps, com.quadcap.sql.DatabaseRoot.getBlobRefCountRoot(), com.quadcap.sql.DatabaseRoot.getForwardDepsNode(), com.quadcap.sql.DatabaseRoot.getIndexIndexNode(), com.quadcap.sql.DatabaseRoot.getRelationIndexNode(), com.quadcap.sql.DatabaseRoot.getReverseDepsNode(), com.quadcap.sql.Database.indexIndex, com.quadcap.sql.Database.nextTransId, com.quadcap.sql.Database.nroot, com.quadcap.sql.Database.reverseDeps, com.quadcap.sql.DatabaseRoot.setNextTransId(), and com.quadcap.sql.Database.tableIndex.

Referenced by com.quadcap.sql.Database.bootFromRoot().

void com.quadcap.sql.Database.checkAuth String  user,
String  passwd
throws SQLException
 

Check the specified authentication credentials; throw an exception if authorization shouldn't be granted.

We really don't care about passwords. This is an embedded database, remember; it's really just a fancy API on top of a simple file!

Definition at line 901 of file Database.java.

References com.quadcap.sql.Database.checkAuth().

Referenced by com.quadcap.sql.Database.checkAuth(), and com.quadcap.sql.Connection.setAuth().

void com.quadcap.sql.Database.checkpointHandler LongMap  activeTransactions  )  throws IOException
 

Called during a checkpoint operation.

Parameters:
activeTransactions is a map whose keys are the set of ids of active transactions.

Definition at line 991 of file Database.java.

References com.quadcap.sql.Database.checkpointHandler(), and com.quadcap.sql.Database.emptyMorgue().

Referenced by com.quadcap.sql.Database.checkpointHandler().

void com.quadcap.sql.Database.checkViewDependency String  base,
String  view
throws SQLException, IOException
 

Make sure that the specified view dependency is valid.

Definition at line 605 of file Database.java.

References com.quadcap.sql.Database.checkViewDependency(), and com.quadcap.sql.Table.getModifiers().

Referenced by com.quadcap.sql.Database.checkViewDependency(), and com.quadcap.sql.StmtCreateView.redo().

void com.quadcap.sql.Database.createRoot String  fileName,
Properties  props
throws IOException
 

Create a new root block.

Definition at line 131 of file Database.java.

References com.quadcap.sql.Database.createRoot(), com.quadcap.sql.Database.flushRoot(), and com.quadcap.sql.Database.inMemory().

Referenced by com.quadcap.sql.Database.createRoot().

void com.quadcap.sql.Database.deleteIndex String  indexName  )  throws IOException
 

Remove the specified index.

Definition at line 284 of file Database.java.

References com.quadcap.sql.Database.deleteIndex(), and com.quadcap.sql.Database.indexIndex.

Referenced by com.quadcap.sql.Database.deleteIndex(), com.quadcap.sql.DeleteConstraint.redo(), and com.quadcap.sql.AddConstraint.undo().

void com.quadcap.sql.Database.delMorgue long  blob  ) 
 

Remove a blob/clob from the morgue.

Definition at line 972 of file Database.java.

References com.quadcap.sql.Database.blobMorgue, and com.quadcap.sql.Database.delMorgue().

Referenced by com.quadcap.sql.Database.delMorgue(), com.quadcap.sql.Database.refCountBlob(), and com.quadcap.sql.InsertBlob.undo().

void com.quadcap.sql.Database.display PrintWriter  w  )  throws IOException
 

Definition at line 1050 of file Database.java.

References com.quadcap.sql.MultiSet.display(), com.quadcap.sql.Database.display(), com.quadcap.sql.Database.forwardDeps, com.quadcap.sql.DatabaseRoot.getBlobRefCountRoot(), com.quadcap.sql.DatabaseRoot.getForwardDepsNode(), com.quadcap.sql.DatabaseRoot.getIndexIndexNode(), com.quadcap.sql.DatabaseRoot.getNextTransId(), com.quadcap.sql.DatabaseRoot.getRelationIndexNode(), com.quadcap.sql.DatabaseRoot.getReverseDepsNode(), com.quadcap.sql.Database.indexIndex, com.quadcap.sql.Database.nroot, com.quadcap.sql.Database.reverseDeps, and com.quadcap.sql.Database.tableIndex.

Referenced by com.quadcap.sql.Database.display().

void com.quadcap.sql.Database.emptyMorgue LongMap  activeTransactions  )  throws IOException
 

Empty the BLOB morgue.

Remove any BLOBS in the morge that were deleted by transactions which have committed.

Definition at line 1001 of file Database.java.

References com.quadcap.sql.Database.blobMorgue, com.quadcap.sql.Database.emptyMorgue(), com.quadcap.sql.Database.enumerateMorgue(), and com.quadcap.util.collections.LongIterator.nextLong().

Referenced by com.quadcap.sql.Database.checkpointHandler(), and com.quadcap.sql.Database.emptyMorgue().

LongIterator com.quadcap.sql.Database.enumerateMorgue  ) 
 

Enumerate the morgue.

Definition at line 981 of file Database.java.

References com.quadcap.sql.Database.blobMorgue.

Referenced by com.quadcap.sql.Database.emptyMorgue().

java.sql.ResultSet com.quadcap.sql.Database.execute Session  session,
String  sql
throws IOException, SQLException
 

Helper to execute a single SQL statement for the given session.

Definition at line 388 of file Database.java.

References com.quadcap.sql.Database.execute(), and com.quadcap.sql.SQLParser.statement().

java.sql.ResultSet com.quadcap.sql.Database.execute String  sql  )  throws SQLException, IOException
 

Helper to execute a single SQL statement (in its own connection) and return a result set.

Definition at line 377 of file Database.java.

References com.quadcap.sql.Connection.createSession(), and com.quadcap.sql.Database.execute().

Referenced by com.quadcap.sql.Database.execute().

void com.quadcap.sql.Database.flushRoot  )  throws IOException
 

Write the database root.

Definition at line 154 of file Database.java.

References com.quadcap.sql.Database.inMemory(), and com.quadcap.sql.Database.rootBlock.

Referenced by com.quadcap.sql.Database.createRoot(), com.quadcap.sql.Database.getNextTransId(), com.quadcap.sql.Database.setBackupCount(), com.quadcap.sql.Database.setBackupDays(), com.quadcap.sql.Database.setBackupDir(), com.quadcap.sql.Database.setBackupFormat(), com.quadcap.sql.Database.setBackupLastDay(), and com.quadcap.sql.Database.setBackupTime().

int com.quadcap.sql.Database.getBackupCount  ) 
 

Return the backup count.

Definition at line 822 of file Database.java.

References com.quadcap.sql.DatabaseRoot.getBackupCount(), and com.quadcap.sql.Database.nroot.

Referenced by com.quadcap.sql.Database.maybeBackup().

int com.quadcap.sql.Database.getBackupDays  ) 
 

Return the backup days.

Definition at line 837 of file Database.java.

References com.quadcap.sql.DatabaseRoot.getBackupDays(), and com.quadcap.sql.Database.nroot.

Referenced by com.quadcap.sql.Database.maybeBackup().

String com.quadcap.sql.Database.getBackupDir  ) 
 

Return the backup directory name.

Definition at line 807 of file Database.java.

References com.quadcap.sql.DatabaseRoot.getBackupDir(), and com.quadcap.sql.Database.nroot.

Referenced by com.quadcap.sql.Database.makeBackupFile().

String com.quadcap.sql.Database.getBackupFormat  ) 
 

Return the backup format.

Definition at line 882 of file Database.java.

References com.quadcap.sql.DatabaseRoot.getBackupFormat(), and com.quadcap.sql.Database.nroot.

Referenced by com.quadcap.sql.Database.makeBackupFile(), and com.quadcap.sql.Database.maybeBackup().

int com.quadcap.sql.Database.getBackupLastDay  ) 
 

Return the backup last day.

Definition at line 852 of file Database.java.

References com.quadcap.sql.DatabaseRoot.getBackupLastDay(), and com.quadcap.sql.Database.nroot.

Referenced by com.quadcap.sql.Database.maybeBackup().

int com.quadcap.sql.Database.getBackupTime  ) 
 

Return the backup time.

Definition at line 867 of file Database.java.

References com.quadcap.sql.DatabaseRoot.getBackupTime(), and com.quadcap.sql.Database.nroot.

Referenced by com.quadcap.sql.Database.maybeBackup().

Enumeration com.quadcap.sql.Database.getBases String  view  )  throws IOException
 

Return an enumeration containing all base tables for the specified view.

Definition at line 635 of file Database.java.

References com.quadcap.sql.MultiSet.get(), com.quadcap.sql.Database.getBases(), and com.quadcap.sql.Database.reverseDeps.

Referenced by com.quadcap.sql.Database.getBases(), and com.quadcap.sql.DropTable.prepare().

int com.quadcap.sql.Database.getConnectionCount  ) 
 

Return the number of active connections.

Definition at line 800 of file Database.java.

References com.quadcap.sql.Database.connectionCount.

QDriver com.quadcap.sql.Database.getDriver  ) 
 

Sleight of hand to get my driver interface.

Definition at line 770 of file Database.java.

References com.quadcap.sql.Database.driver.

Referenced by com.quadcap.sql.SelectStmt.execute().

long com.quadcap.sql.Database.getNextTransId  )  throws IOException
 

Return the next available transaction ID.

Definition at line 182 of file Database.java.

References com.quadcap.sql.Database.flushRoot(), com.quadcap.sql.Database.inMemory(), com.quadcap.sql.Database.nextTransId, com.quadcap.sql.Database.nroot, and com.quadcap.sql.DatabaseRoot.setNextTransId().

int com.quadcap.sql.Database.getPermBlobRefCount long  blob  )  throws IOException
 

Return the current persistent refcount for the specified blob.

Definition at line 908 of file Database.java.

References com.quadcap.sql.Database.blobPermRefCounts, com.quadcap.sql.Database.getPermBlobRefCount(), and com.quadcap.sql.Database.key.

Referenced by com.quadcap.sql.Database.getPermBlobRefCount().

Relation com.quadcap.sql.Database.getRelation String  name  )  throws IOException
 

Return the table/view with the specified name.

XXX Fix this "cache" implementation

Definition at line 411 of file Database.java.

References com.quadcap.sql.Database.getRelation(), com.quadcap.sql.index.BCursor.getValBuf(), com.quadcap.sql.Database.inMemory(), com.quadcap.sql.index.BCursor.release(), com.quadcap.sql.index.BCursor.seek(), com.quadcap.sql.Database.tableIndex, and com.quadcap.sql.Database.tableMap.

Referenced by com.quadcap.sql.StmtUpdate.execute(), com.quadcap.sql.StmtInsert.execute(), com.quadcap.sql.StmtDropTable.execute(), com.quadcap.sql.StmtDropIndex.execute(), com.quadcap.sql.StmtDropConstraint.execute(), com.quadcap.sql.StmtDropColumn.execute(), com.quadcap.sql.StmtDelete.execute(), com.quadcap.sql.StmtCreateIndex.execute(), com.quadcap.sql.StmtAlterColumn.execute(), com.quadcap.sql.StmtAddConstraint.execute(), com.quadcap.sql.StmtAddColumn.execute(), com.quadcap.sql.SelectFromTable.getCursor(), com.quadcap.sql.ModIndexEntry.getIndex(), com.quadcap.sql.Database.getRelation(), com.quadcap.sql.Database.getTableIdentity(), com.quadcap.sql.meta.MetaBestRowId.MetaBestRowId(), com.quadcap.sql.meta.MetaColumns.MetaColumns(), com.quadcap.sql.meta.MetaCrossReference.MetaCrossReference(), com.quadcap.sql.meta.MetaIndexInfo.MetaIndexInfo(), com.quadcap.sql.meta.MetaPrimaryKeys.MetaPrimaryKeys(), com.quadcap.sql.meta.MetaTables.MetaTables(), com.quadcap.sql.AddTable.prepare(), com.quadcap.sql.StmtRenameTable.rename(), com.quadcap.sql.StmtRenameTable.renameForeignKeys(), com.quadcap.sql.StmtRenameTable.renameView(), and com.quadcap.sql.Database.updateTableIdentity().

Iterator com.quadcap.sql.Database.getRelationNameIterator  )  throws IOException
 

This hacky crack of encapsulation is for sql.meta.MetaTables, to support DatabaseMetaData.getTables().

All he really needs is an Iterator which returns the table names....

Definition at line 671 of file Database.java.

References com.quadcap.sql.index.BCursor.delete(), com.quadcap.sql.index.BCursor.getKey(), com.quadcap.sql.Database.inMemory(), com.quadcap.sql.index.BCursor.next(), com.quadcap.sql.index.BCursor.release(), com.quadcap.sql.Database.tableIndex, and com.quadcap.sql.Database.tableMap.

Referenced by com.quadcap.sql.meta.MetaColumns.MetaColumns(), com.quadcap.sql.meta.MetaCrossReference.MetaCrossReference(), com.quadcap.sql.meta.MetaIndexInfo.MetaIndexInfo(), com.quadcap.sql.meta.MetaPrimaryKeys.MetaPrimaryKeys(), com.quadcap.sql.meta.MetaSchemas.MetaSchemas(), and com.quadcap.sql.meta.MetaTables.MetaTables().

void com.quadcap.sql.Database.getRow long  rowId,
LazyRow  row,
boolean  isTemp
throws IOException, SQLException
 

Definition at line 1125 of file Database.java.

References com.quadcap.sql.file.BlockFile.getBytes(), com.quadcap.sql.Row.getItem(), com.quadcap.sql.file.BlockFile.getObject(), com.quadcap.sql.Database.getRow(), com.quadcap.sql.Database.inMemory(), and com.quadcap.sql.Row.size().

Referenced by com.quadcap.sql.JoinInnerCursor.bnext(), com.quadcap.sql.StmtDropColumn.execute(), com.quadcap.sql.StmtAddColumn.execute(), com.quadcap.sql.IndexCursor.fetchCurrentRow(), com.quadcap.sql.DeletedRows.finish(), com.quadcap.sql.TempTable.getRow(), com.quadcap.sql.Database.getRow(), and com.quadcap.sql.DeleteRow.prepare().

final Session com.quadcap.sql.Database.getSession Transaction  t  )  throws IOException, SQLException [package]
 

Definition at line 1035 of file Database.java.

References com.quadcap.sql.Connection.createSession(), com.quadcap.sql.Database.getSession(), com.quadcap.sql.Connection.trans, com.quadcap.sql.Connection.transId, com.quadcap.sql.Database.zConn, and com.quadcap.sql.Database.zSession.

Referenced by com.quadcap.sql.Database.getSession(), com.quadcap.sql.LogStep.redo(), and com.quadcap.sql.LogStep.undo().

String com.quadcap.sql.Database.getTableForIndex String  indexName  )  throws IOException
 

Return the table for the index of the specified name.

Definition at line 273 of file Database.java.

References com.quadcap.sql.Database.getTableForIndex(), and com.quadcap.sql.Database.indexIndex.

Referenced by com.quadcap.sql.StmtDropIndex.execute(), com.quadcap.sql.StmtCreateIndex.execute(), and com.quadcap.sql.Database.getTableForIndex().

long com.quadcap.sql.Database.getTableIdentity String  name  )  throws IOException, SQLException
 

Return the table identity for the table.

Exceptions:
SQLException if the table can't be located

Definition at line 318 of file Database.java.

References com.quadcap.sql.Database.getRelation(), com.quadcap.sql.Database.getTableIdentity(), com.quadcap.sql.index.BCursor.getValBuf(), com.quadcap.sql.index.BCursor.getValLen(), com.quadcap.sql.Database.inMemory(), com.quadcap.sql.index.BCursor.release(), com.quadcap.sql.index.BCursor.seek(), com.quadcap.sql.Table.tableIdentity, and com.quadcap.sql.Database.tableIndex.

Referenced by com.quadcap.sql.AutoNumberConstraint.checkInsert(), and com.quadcap.sql.Database.getTableIdentity().

Enumeration com.quadcap.sql.Database.getViews String  base  )  throws IOException
 

Return an enumeration of all views for the specified base table.

Definition at line 625 of file Database.java.

References com.quadcap.sql.Database.forwardDeps, com.quadcap.sql.MultiSet.get(), and com.quadcap.sql.Database.getViews().

Referenced by com.quadcap.sql.StmtDropTable.execute(), com.quadcap.sql.Database.getViews(), and com.quadcap.sql.StmtRenameTable.rename().

void com.quadcap.sql.Database.init QDriver  driver,
String  url,
String  fileName,
Properties  props
throws IOException, SQLException
 

Definition at line 120 of file Database.java.

References com.quadcap.sql.Database.driver, and com.quadcap.sql.Database.init().

Referenced by com.quadcap.jdbc.JdbcDriver.connect(), and com.quadcap.sql.Database.init().

boolean com.quadcap.sql.Database.inMemory  ) 
 

Definition at line 1171 of file Database.java.

Referenced by com.quadcap.sql.Database.addRelation(), com.quadcap.sql.Database.createRoot(), com.quadcap.sql.StmtDropColumn.execute(), com.quadcap.sql.StmtAddColumn.execute(), com.quadcap.sql.Database.flushRoot(), com.quadcap.sql.Database.getNextTransId(), com.quadcap.sql.Database.getRelation(), com.quadcap.sql.Database.getRelationNameIterator(), com.quadcap.sql.Database.getRow(), com.quadcap.sql.Database.getTableIdentity(), com.quadcap.sql.Database.maybeBackup(), com.quadcap.sql.InsertRow.prepare(), com.quadcap.sql.DeleteRow.prepare(), com.quadcap.sql.Database.putRow(), com.quadcap.sql.UpdateRow.redo(), com.quadcap.sql.Database.removeRelation(), com.quadcap.sql.Database.removeRow(), com.quadcap.sql.Database.renameRelation(), com.quadcap.sql.TempTable.TempTable(), com.quadcap.sql.UpdateRow.undo(), com.quadcap.sql.DeleteRow.undo(), com.quadcap.sql.Database.updateRelation(), com.quadcap.sql.TableOps.updateRow(), and com.quadcap.sql.Database.updateTableIdentity().

File com.quadcap.sql.Database.makeBackupFile int  n  )  throws IOException [package]
 

Definition at line 245 of file Database.java.

References com.quadcap.sql.Database.getBackupDir(), com.quadcap.sql.Database.getBackupFormat(), and com.quadcap.sql.Database.makeBackupFile().

Referenced by com.quadcap.sql.Database.makeBackupFile(), and com.quadcap.sql.Database.maybeBackup().

void com.quadcap.sql.Database.maybeBackup  )  throws IOException
 

Figure out if it's time to do a backup.

Definition at line 196 of file Database.java.

References com.quadcap.sql.Backup.backup(), com.quadcap.sql.Database.backupClass, com.quadcap.sql.Database.driver, com.quadcap.sql.Database.getBackupCount(), com.quadcap.sql.Database.getBackupDays(), com.quadcap.sql.Database.getBackupFormat(), com.quadcap.sql.Database.getBackupLastDay(), com.quadcap.sql.Database.getBackupTime(), com.quadcap.sql.Database.inMemory(), com.quadcap.sql.Database.makeBackupFile(), com.quadcap.sql.QDriver.makeConnection(), and com.quadcap.sql.Database.setBackupLastDay().

final void com.quadcap.sql.Database.putRow Session  session,
Tuple  t,
long  rowId,
Row  row
throws SQLException, IOException
 

Convenience method to update a table row.

Definition at line 1108 of file Database.java.

References com.quadcap.sql.Database.inMemory().

long com.quadcap.sql.Database.putRow Session  session,
BlockFile  f,
Tuple  t,
Row  row
throws SQLException, IOException
 

Convenience method to write a new row to the database.

Definition at line 1083 of file Database.java.

References com.quadcap.sql.Database.inMemory(), and com.quadcap.sql.Database.putRow().

Referenced by com.quadcap.sql.TempTableMerge.addRows(), com.quadcap.sql.TempTable.addRows(), com.quadcap.sql.JoinInnerCursor.makeTemporaryIndexForView(), com.quadcap.sql.InsertRow.prepare(), com.quadcap.sql.Database.putRow(), com.quadcap.sql.UpdateRow.redo(), com.quadcap.sql.UpdateRow.undo(), and com.quadcap.sql.DeleteRow.undo().

void com.quadcap.sql.Database.readRoot  )  throws IOException
 

Read the root block from an existing database.

Definition at line 145 of file Database.java.

References com.quadcap.sql.Database.nroot, and com.quadcap.sql.Database.rootBlock.

int com.quadcap.sql.Database.refCountBlob long  transId,
long  blob,
int  incr
throws IOException
 

Definition at line 924 of file Database.java.

References com.quadcap.sql.Database.addMorgue(), com.quadcap.sql.Database.blobPermRefCounts, com.quadcap.sql.Database.delMorgue(), com.quadcap.sql.Database.key, and com.quadcap.sql.Database.refCountBlob().

Referenced by com.quadcap.sql.RefcountBlob.redo(), com.quadcap.sql.Database.refCountBlob(), and com.quadcap.sql.RefcountBlob.undo().

void com.quadcap.sql.Database.removeConnection  ) 
 

Remove a connection.

If the connection count drops to zero, we get crafty.

Definition at line 778 of file Database.java.

References com.quadcap.sql.Database.closeCount, com.quadcap.sql.QDriver.closeDatabase(), com.quadcap.sql.Database.connectionCount, com.quadcap.sql.Database.driver, and com.quadcap.sql.Database.driverLock.

Referenced by com.quadcap.sql.Connection.close(), and com.quadcap.jdbc.JdbcDriver.connect().

void com.quadcap.sql.Database.removeRelation String  name  )  throws IOException, SQLException
 

Delete the specified table/view.

Definition at line 480 of file Database.java.

References com.quadcap.sql.index.BCursor.delete(), com.quadcap.sql.index.BCursor.getValAsLong(), com.quadcap.sql.Database.inMemory(), com.quadcap.sql.index.BCursor.release(), com.quadcap.sql.Database.removeRelation(), com.quadcap.sql.Database.removeViewDependencies(), com.quadcap.sql.index.BCursor.seek(), com.quadcap.sql.Database.tableIndex, and com.quadcap.sql.Database.tableMap.

Referenced by com.quadcap.sql.DropTable.redo(), com.quadcap.sql.Database.removeRelation(), com.quadcap.sql.StmtCreateView.undo(), and com.quadcap.sql.AddTable.undo().

void com.quadcap.sql.Database.removeRow BlockFile  file,
long  rowId
throws IOException
 

Definition at line 1163 of file Database.java.

References com.quadcap.sql.Database.inMemory().

void com.quadcap.sql.Database.removeRow long  rowId  )  throws IOException
 

Definition at line 1159 of file Database.java.

References com.quadcap.sql.Database.removeRow().

Referenced by com.quadcap.sql.JoinInnerCursor.freeRows(), com.quadcap.sql.DeleteRow.redo(), com.quadcap.sql.Database.removeRow(), and com.quadcap.sql.InsertRow.undo().

void com.quadcap.sql.Database.removeViewDependencies String  view  )  throws SQLException, IOException
 

Definition at line 641 of file Database.java.

References com.quadcap.sql.MultiSet.delete(), com.quadcap.sql.Database.forwardDeps, and com.quadcap.sql.Database.removeViewDependencies().

Referenced by com.quadcap.sql.Database.removeRelation(), and com.quadcap.sql.Database.removeViewDependencies().

void com.quadcap.sql.Database.renameIndexedTable String  oldN,
String  newN
throws IOException [package]
 

RENAME TABLE percolates into the index index...

Definition at line 293 of file Database.java.

References com.quadcap.sql.index.BCursor.getVal(), com.quadcap.sql.Database.indexIndex, com.quadcap.sql.index.BCursor.next(), com.quadcap.sql.index.BCursor.prev(), com.quadcap.sql.index.BCursor.release(), com.quadcap.sql.Database.renameIndexedTable(), and com.quadcap.sql.index.BCursor.replace().

Referenced by com.quadcap.sql.Database.renameIndexedTable().

void com.quadcap.sql.