| java.lang.Object com.quadcap.sql.file.Datafile com.quadcap.sql.Database
Database | public class Database extends Datafile (Code) | | This class implements the QED SQL database outer API.
author: Stan Bailes |
Method Summary | |
public int | addConnection() | public void | addIndex(String indexName, String tableName) TODO: XXX Unicode!!!
Add a new named index for the specified table. | public void | addMorgue(long blob, long transId) | public void | addRelation(Relation table) | public void | addViewDependency(String base, String view) | public void | bootFromRoot(boolean restart) | public void | checkAuth(String user, String passwd) Check the specified authentication credentials; throw an exception
if authorization shouldn't be granted.
We really don't care about passwords. | public void | checkViewDependency(String base, String view) | public void | checkpointHandler(LongMap activeTransactions) Called during a checkpoint operation. | public void | createRoot(String fileName, Properties props) | public void | delMorgue(long blob) | public void | deleteIndex(String indexName) | public void | display(PrintWriter w) | public void | emptyMorgue(LongMap activeTransactions) Empty the BLOB morgue. | public LongIterator | enumerateMorgue() Enumerate the morgue. | public java.sql.ResultSet | execute(String sql) Helper to execute a single SQL statement (in its own connection)
and return a result set. | public java.sql.ResultSet | execute(Session session, String sql) Helper to execute a single SQL statement for the given session. | public void | flushRoot() | public int | getBackupCount() | public int | getBackupDays() | public String | getBackupDir() | public String | getBackupFormat() | public int | getBackupLastDay() | public int | getBackupTime() | public Enumeration | getBases(String view) | public int | getConnectionCount() | public QDriver | getDriver() | public long | getNextTransId() Return the next available transaction ID. | public int | getPermBlobRefCount(long blob) Return the current persistent refcount for the specified blob. | public Relation | getRelation(String name) | public Iterator | getRelationNameIterator() This hacky crack of encapsulation is for sql.meta.MetaTables, to
support DatabaseMetaData.getTables(). | public void | getRow(long rowId, LazyRow row, boolean isTemp) | final Session | getSession(Transaction t) | public String | getTableForIndex(String indexName) Return the table for the index of the specified name. | public long | getTableIdentity(String name) | public Enumeration | getViews(String base) | public boolean | inMemory() | public void | init(QDriver driver, String url, String fileName, Properties props) | File | makeBackupFile(int n) | public void | maybeBackup() Figure out if it's time to do a backup. | public long | putRow(Session session, BlockFile f, Tuple t, Row row) | final public void | putRow(Session session, Tuple t, long rowId, Row row) | public void | readRoot() | public int | refCountBlob(long transId, long blob, int incr) | public void | removeConnection() Remove a connection. | public void | removeRelation(String name) | public void | removeRow(long rowId) | public void | removeRow(BlockFile file, long rowId) | public void | removeViewDependencies(String view) | void | renameIndexedTable(String oldN, String newN) RENAME TABLE percolates into the index index... | public void | renameRelation(Relation r, String newN) Rename a relation. | public void | setBackupCount(int count) | public void | setBackupDays(int count) | public void | setBackupDir(String str) | public void | setBackupFormat(String str) | public void | setBackupLastDay(int day) | public void | setBackupTime(int time) | public void | updateRelation(Relation table) | public void | updateTableIdentity(String name, long num) 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. |
blobMorgue | LongMap blobMorgue(Code) | | The Morgue; BLOB/CLOBs with zero (persistent) refcounts:
blobRef -> any
|
closeCount | int closeCount(Code) | | |
connectionCount | int connectionCount(Code) | | |
nextTransId | long nextTransId(Code) | | |
rootBlock | long rootBlock(Code) | | |
Database | public Database()(Code) | | Constructor
|
addConnection | public int addConnection()(Code) | | Add a new connection (just remember the count...)
|
addIndex | public void addIndex(String indexName, String tableName) throws IOException(Code) | | TODO: XXX Unicode!!!
Add a new named index for the specified table.
|
addMorgue | public void addMorgue(long blob, long transId)(Code) | | Add a blob/clob to the morgue
|
addViewDependency | public void addViewDependency(String base, String view) throws IOException(Code) | | Establish the dependency link between a view and a base table
|
bootFromRoot | public void bootFromRoot(boolean restart) throws IOException(Code) | | Get ready to rumble!!!
|
checkAuth | public void checkAuth(String user, String passwd) throws SQLException(Code) | | 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!
|
checkpointHandler | public void checkpointHandler(LongMap activeTransactions) throws IOException(Code) | | Called during a checkpoint operation.
Parameters: activeTransactions - is a map whose keys are the set ofids of active transactions. |
delMorgue | public void delMorgue(long blob)(Code) | | Remove a blob/clob from the morgue
|
emptyMorgue | public void emptyMorgue(LongMap activeTransactions) throws IOException(Code) | | Empty the BLOB morgue. Remove any BLOBS in the morge that were
deleted by transactions which have committed.
|
getBackupCount | public int getBackupCount()(Code) | | Return the backup count
|
getBackupDays | public int getBackupDays()(Code) | | Return the backup days
|
getBackupDir | public String getBackupDir()(Code) | | Return the backup directory name
|
getBackupFormat | public String getBackupFormat()(Code) | | Return the backup format
|
getBackupLastDay | public int getBackupLastDay()(Code) | | Return the backup last day
|
getBackupTime | public int getBackupTime()(Code) | | Return the backup time
|
getConnectionCount | public int getConnectionCount()(Code) | | Return the number of active connections
|
getDriver | public QDriver getDriver()(Code) | | Sleight of hand to get my driver interface
|
getNextTransId | public long getNextTransId() throws IOException(Code) | | Return the next available transaction ID.
|
getPermBlobRefCount | public int getPermBlobRefCount(long blob) throws IOException(Code) | | Return the current persistent refcount for the specified blob.
|
getRelation | public Relation getRelation(String name) throws IOException(Code) | | Return the table/view with the specified name
XXX Fix this "cache" implementation
|
getRelationNameIterator | public Iterator getRelationNameIterator() throws IOException(Code) | | 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....
|
inMemory | public boolean inMemory()(Code) | | |
maybeBackup | public void maybeBackup() throws IOException(Code) | | Figure out if it's time to do a backup.
|
readRoot | public void readRoot() throws IOException(Code) | | Read the root block from an existing database
|
refCountBlob | public int refCountBlob(long transId, long blob, int incr) throws IOException(Code) | | |
removeConnection | public void removeConnection()(Code) | | Remove a connection. If the connection count drops to zero, we
get crafty.
|
renameRelation | public void renameRelation(Relation r, String newN) throws IOException(Code) | | Rename a relation. This involves:
1. Changing the cached relation
2. Changing the btree index to the relation
3. Changing any indexIndex entries referring to the rel
4. Changing any forwardDeps or backwardDeps which
refer to the relation
|
setBackupCount | public void setBackupCount(int count) throws IOException(Code) | | Set the backup count
|
setBackupDays | public void setBackupDays(int count) throws IOException(Code) | | Set the backup days
|
setBackupLastDay | public void setBackupLastDay(int day) throws IOException(Code) | | Set the backup last day
|
setBackupTime | public void setBackupTime(int time) throws IOException(Code) | | Set the backup time
|
updateRelation | public void updateRelation(Relation table) throws IOException(Code) | | Store a modified version of the specified view/table to the
store
|
updateTableIdentity | public void updateTableIdentity(String name, long num) throws IOException, SQLException(Code) | | 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.
|
Methods inherited from com.quadcap.sql.file.Datafile | abstract public void bootFromRoot(boolean restart) throws IOException(Code)(Java Doc) public void checkpoint(boolean truncate, boolean fastSync) throws IOException(Code)(Java Doc) public void checkpointHandler(LongMap activeTransactions) throws IOException(Code)(Java Doc) public void close()(Code)(Java Doc) public void commitTransaction(Transaction trans) throws IOException(Code)(Java Doc) abstract public void createRoot(String fileName, Properties props) throws IOException(Code)(Java Doc) public void doStep(Transaction t, LogEntry e) throws IOException, DatafileException(Code)(Java Doc) public void finalize() throws Throwable(Code)(Java Doc) public Transaction findTransaction(long transId) throws IOException(Code)(Java Doc) abstract public void flushRoot() throws IOException(Code)(Java Doc) public BlockFile getFile()(Code)(Java Doc) public Object getFileLock()(Code)(Java Doc) public LockManager getLockManager()(Code)(Java Doc) final public Log getLog()(Code)(Java Doc) abstract public long getNextTransId() throws IOException(Code)(Java Doc) public Object getObject(long ref) throws IOException(Code)(Java Doc) public long getSize()(Code)(Java Doc) public BlockFile getTempFile() throws IOException(Code)(Java Doc) public BlockFile getTempFile(boolean incr) throws IOException(Code)(Java Doc) public String getURL()(Code)(Java Doc) public boolean inRecovery() throws IOException(Code)(Java Doc) public void init(String url, String fileName, Properties props) throws IOException(Code)(Java Doc) public void initFileDatabase(String url, String fileName, Properties props) throws IOException(Code)(Java Doc) public void initMemoryDatabase(String url, String fileName, Properties props) throws IOException(Code)(Java Doc) public boolean isReadOnly()(Code)(Java Doc) final public Transaction makeTransaction(boolean writeLog) throws IOException(Code)(Java Doc) abstract public void maybeBackup() throws IOException(Code)(Java Doc) public long putObject(Object obj) throws IOException(Code)(Java Doc) abstract public void readRoot() throws IOException(Code)(Java Doc) public void releaseLocks(Transaction trans)(Code)(Java Doc) public void releaseTempFile()(Code)(Java Doc) public void removeObject(long ref) throws IOException(Code)(Java Doc) public void rollbackStatement(Transaction trans, int stmtId) throws IOException(Code)(Java Doc) public void rollbackTransaction(Transaction trans) throws IOException(Code)(Java Doc) public String toString()(Code)(Java Doc) public void updateObject(long seg, Object obj) throws IOException(Code)(Java Doc)
|
|
|