![]() |
Quadcap Embeddable Database |
Inheritance diagram for com.quadcap.sql.Connection:

Connection, this class maintains state and locks on behalf of a single session.
Definition at line 71 of file Connection.java.
Public Member Functions | |
| Connection (Database db, String auth, String passwd) throws SQLException | |
| Construct a new connection for the specified database with the specified authorization. | |
| final Session | createSession () throws IOException, SQLException |
| Create a new session and store it in the session table. | |
| final void | removeSession (Session session) |
| final Database | getDatabase () |
| Accessor for my database. | |
| final BlockFile | getFile () |
| Accessor for my file. | |
| final void | endTransaction () throws IOException, SQLException |
| Commit the current transaction. | |
| final void | rollbackTransaction () throws IOException, SQLException |
| Roll back this transaction. | |
| void | abort (Transaction t) throws IOException |
| TransactionObserver implementation: abort the current transaction. | |
| final Transaction | getTransaction () |
| Return the current transaction. | |
| final long | getTransactionId () |
| Return the current transaction id as a long. | |
| final void | setAutoCommit (boolean b) |
| Public setter for the 'autoCommit' flag. | |
| final boolean | getAutoCommit () |
| Public accessor for the 'autoCommit' flag. | |
| final void | setAuth (String auth, String passwd) throws SQLException |
| Set the current authorization code. | |
| final String | getAuth () |
| final void | close () throws SQLException, IOException |
| Close this connection. | |
| boolean | isClosed () |
| Return true if this compare is closed. | |
| boolean | isReadOnly () |
| Return true if this connection is read-only. | |
| String | toString () |
| String | getLabel () |
Package Functions | |
| final Session | getSession (int i) |
| final void | closeSessions () |
| Close all the sessions in the table. | |
| final String | resolveName (String name) |
| Given a SQL ID, attempt to generate a fully qualified name by prepending the current schema name. | |
| final String | resolveColname (String name, Tuple cursorTuple) |
| Return a fully qualified column name. | |
| Random | getRandom () |
| Accessor for my 'Random' object. | |
| final BlockFile | getTempFile (boolean holdRef) throws IOException |
| The BLOB code (InsertBlob) needs access to the temp file. | |
| void | endStatement (Session session, boolean abort) throws IOException, SQLException |
| At statement end, if autoCommit is TRUE, we commit (or rollback) the transaction. | |
| final void | rollbackStatement (Session s) throws IOException, SQLException |
| Statement rollback. | |
| final void | checkAborted () throws SQLException |
| final Transaction | makeTransaction () throws SQLException |
| Return (lazy create) the current Transaction. | |
| final Lock | getDbLock (int mode) throws IOException, SQLException |
| Get the database root lock in the specified mode. | |
| final void | getTableWriteLock (String tableName) throws SQLException, IOException |
| Helper routine to obtain a write lock on the specified table. | |
| final void | getTableReadLock (String tableName) throws SQLException, IOException |
| Helper routine to obtain a read lock on the specified table. | |
| final void | releaseLocks () |
| At transaction end, release our cached locks. | |
| final void | finishContexts () throws SQLException, IOException |
| Each context object represents some state retained on behalf of a constraint. | |
| final boolean | inRecovery () throws IOException |
| Access to 'recovery' flag. | |
| final Btree | makeTempTree (Comparator compare) throws IOException |
| Make a new (temporary) btree structure in the current database. | |
| final Btree | makeTempTree () throws IOException |
| final StatementContext | getContext (Object obj) |
| Return a saved context. | |
| final void | putContext (Object key, StatementContext val) |
| Add a new statement context. | |
| long | getLastInsertId () |
| void | setLastInsertId (long id) |
Static Package Functions | |
| final int | countDots (String name) |
| Return the number of '.' delimiters in this identifier, skipping over any occurrences of '.' within delimted identifiers (i.e., literal strings surrounded by double quotes.). | |
Package Attributes | |
| Object | connLock |
| Object | fileLock |
| Transaction | trans = null |
| boolean | transAborted = false |
| long | transId = -1 |
| String | auth |
| boolean | writeLog = true |
| boolean | autoCommit = true |
| Database | db |
| BlockFile | file |
| Hashtable | rlocks = new Hashtable() |
| Hashtable | wlocks = new Hashtable() |
| Lock | db_IS = null |
| Lock | db_IX = null |
| Hashtable | transContext = null |
| Random | random = null |
| boolean | readOnly = false |
| List | sessions = new ArrayList() |
| int | nextSession = -1 |
| boolean | isClosed = false |
| long | lastInsertId = -1 |
| int | id |
Static Package Attributes | |
| int | lastId = 0 |
Private Member Functions | |
| final Log | getLog () |
| Accessor for my log. | |
|
||||||||||||||||
|
Construct a new connection for the specified database with the specified authorization.
Definition at line 113 of file Connection.java. References com.quadcap.sql.Connection.auth, com.quadcap.sql.Connection.db, com.quadcap.sql.Connection.file, com.quadcap.sql.Connection.lastId, and com.quadcap.sql.Connection.setAuth(). |
|
|
TransactionObserver implementation: abort the current transaction.
Definition at line 383 of file Connection.java. References com.quadcap.sql.Connection.abort(), com.quadcap.sql.Connection.db, com.quadcap.sql.Connection.releaseLocks(), com.quadcap.sql.Connection.transAborted, and com.quadcap.sql.Connection.transContext. Referenced by com.quadcap.sql.Connection.abort(), and com.quadcap.sql.Connection.endStatement(). |
|
|
Definition at line 407 of file Connection.java. References com.quadcap.sql.Connection.connLock, and com.quadcap.sql.Connection.transAborted. Referenced by com.quadcap.sql.Connection.endTransaction(), com.quadcap.sql.Connection.makeTransaction(), and com.quadcap.sql.Connection.rollbackStatement(). |
|
|
Close this connection. Close all statement sessions and end the transaction. Definition at line 649 of file Connection.java. References com.quadcap.sql.Connection.autoCommit, com.quadcap.sql.Connection.closeSessions(), com.quadcap.sql.Connection.db, com.quadcap.sql.Connection.endTransaction(), com.quadcap.sql.Connection.isClosed, com.quadcap.sql.Connection.readOnly, com.quadcap.sql.Database.removeConnection(), com.quadcap.sql.Connection.rollbackTransaction(), com.quadcap.sql.Connection.toString(), and com.quadcap.sql.Connection.trans. Referenced by com.quadcap.sql.tools.XmlLoad.main(), and com.quadcap.sql.tools.XmlDump.main(). |
|
|
Close all the sessions in the table.
Definition at line 180 of file Connection.java. References com.quadcap.sql.Session.close(), com.quadcap.sql.Connection.nextSession, and com.quadcap.sql.Connection.sessions. Referenced by com.quadcap.sql.Connection.close(). |
|
|
Return the number of '.' delimiters in this identifier, skipping over any occurrences of '.' within delimted identifiers (i.e., literal strings surrounded by double quotes.).
Definition at line 214 of file Connection.java. References com.quadcap.sql.Connection.countDots(). Referenced by com.quadcap.sql.Connection.countDots(), and com.quadcap.sql.Connection.resolveName(). |
|
|
Create a new session and store it in the session table.
Definition at line 133 of file Connection.java. References com.quadcap.sql.Connection.nextSession, and com.quadcap.sql.Connection.sessions. Referenced by com.quadcap.sql.Database.execute(), and com.quadcap.sql.Database.getSession(). |
|
||||||||||||
|
At statement end, if autoCommit is TRUE, we commit (or rollback) the transaction.
Definition at line 283 of file Connection.java. References com.quadcap.sql.Connection.abort(), com.quadcap.sql.Connection.autoCommit, com.quadcap.sql.Connection.endStatement(), com.quadcap.sql.Connection.endTransaction(), com.quadcap.sql.Connection.rollbackTransaction(), and com.quadcap.sql.Connection.trans. Referenced by com.quadcap.sql.Session.endStatement(), and com.quadcap.sql.Connection.endStatement(). |
|
|
Commit the current transaction. PRE: cursors closed, statements finished. POST: transaction commit/rollback, locks released Definition at line 301 of file Connection.java. References com.quadcap.sql.Connection.checkAborted(), com.quadcap.sql.Connection.connLock, com.quadcap.sql.Connection.db, com.quadcap.sql.Connection.fileLock, com.quadcap.sql.Connection.finishContexts(), com.quadcap.sql.Connection.readOnly, com.quadcap.sql.Connection.releaseLocks(), com.quadcap.sql.Connection.toString(), com.quadcap.sql.Connection.trans, and com.quadcap.sql.Connection.transContext. Referenced by com.quadcap.sql.Connection.close(), and com.quadcap.sql.Connection.endStatement(). |
|
|
Each context object represents some state retained on behalf of a constraint. The 'finish()' method of the context is used to perform any constraint-specific processing at the end of a statement/transaction. Definition at line 557 of file Connection.java. References com.quadcap.sql.StatementContext.finish(), com.quadcap.sql.StatementContext.priority(), com.quadcap.sql.Connection.toString(), and com.quadcap.sql.Connection.transContext. Referenced by com.quadcap.sql.Connection.endTransaction(). |
|
|
Definition at line 606 of file Connection.java. References com.quadcap.sql.Connection.auth. Referenced by com.quadcap.sql.meta.MetaSchemas.MetaSchemas(), and com.quadcap.sql.SQLParser.systemVariable(). |
|
|
Public accessor for the 'autoCommit' flag.
Definition at line 547 of file Connection.java. References com.quadcap.sql.Connection.autoCommit. |
|
|
Return a saved context.
Definition at line 630 of file Connection.java. References com.quadcap.sql.Connection.getContext(), and com.quadcap.sql.Connection.transContext. Referenced by com.quadcap.sql.Session.getContext(), and com.quadcap.sql.Connection.getContext(). |
|
|
Accessor for my database.
Definition at line 252 of file Connection.java. References com.quadcap.sql.Connection.db. Referenced by com.quadcap.sql.Session.Session(). |
|
|
Get the database root lock in the specified mode.
Definition at line 453 of file Connection.java. References com.quadcap.sql.Connection.connLock, com.quadcap.sql.Connection.db, com.quadcap.sql.Connection.db_IS, com.quadcap.sql.Connection.db_IX, com.quadcap.sql.Connection.getDbLock(), com.quadcap.sql.Connection.makeTransaction(), and com.quadcap.sql.Connection.trans. Referenced by com.quadcap.sql.Connection.getDbLock(). |
|
|
Accessor for my file.
Definition at line 262 of file Connection.java. References com.quadcap.sql.Connection.file. Referenced by com.quadcap.sql.Session.getFile(). |
|
|
Definition at line 695 of file Connection.java. References com.quadcap.sql.Connection.trans. |
|
|
Definition at line 699 of file Connection.java. References com.quadcap.sql.Connection.lastInsertId. Referenced by com.quadcap.sql.Session.Session(). |
|
|
Accessor for my log.
Definition at line 257 of file Connection.java. References com.quadcap.sql.Connection.db. |
|
|
Accessor for my 'Random' object.
Definition at line 267 of file Connection.java. References com.quadcap.sql.Connection.random. Referenced by com.quadcap.sql.Session.getRandom(). |
|
|
Definition at line 159 of file Connection.java. References com.quadcap.sql.Connection.getSession(), and com.quadcap.sql.Connection.sessions. Referenced by com.quadcap.sql.Connection.getSession(). |
|
|
Helper routine to obtain a read lock on the specified table.
Definition at line 501 of file Connection.java. References com.quadcap.sql.Connection.connLock, com.quadcap.sql.Connection.db, com.quadcap.sql.Connection.getTableReadLock(), com.quadcap.sql.Connection.inRecovery(), com.quadcap.sql.Connection.readOnly, com.quadcap.sql.Connection.rlocks, and com.quadcap.sql.Connection.trans. Referenced by com.quadcap.sql.Session.getTableReadLock(), and com.quadcap.sql.Connection.getTableReadLock(). |
|
|
Helper routine to obtain a write lock on the specified table.
Definition at line 484 of file Connection.java. References com.quadcap.sql.Connection.connLock, com.quadcap.sql.Connection.db, com.quadcap.sql.Connection.getTableWriteLock(), com.quadcap.sql.Connection.inRecovery(), com.quadcap.sql.Connection.readOnly, com.quadcap.sql.Connection.trans, and com.quadcap.sql.Connection.wlocks. Referenced by com.quadcap.sql.Session.getTableWriteLock(), and com.quadcap.sql.Connection.getTableWriteLock(). |
|
|
The BLOB code (InsertBlob) needs access to the temp file.
Definition at line 275 of file Connection.java. References com.quadcap.sql.Connection.db, and com.quadcap.sql.Connection.getTempFile(). Referenced by com.quadcap.sql.Connection.getTempFile(). |
|
|
Return the current transaction.
Definition at line 419 of file Connection.java. References com.quadcap.sql.Connection.trans. Referenced by com.quadcap.sql.Session.getTransaction(). |
|
|
Return the current transaction id as a long.
Definition at line 424 of file Connection.java. References com.quadcap.sql.Connection.transId. Referenced by com.quadcap.sql.Session.doStep(), com.quadcap.sql.Session.getTransactionId(), and com.quadcap.sql.Session.makeTransaction(). |
|
|
Access to 'recovery' flag.
Definition at line 604 of file Connection.java. References com.quadcap.sql.Connection.db. Referenced by com.quadcap.sql.Connection.getTableReadLock(), com.quadcap.sql.Connection.getTableWriteLock(), and com.quadcap.sql.Session.inRecovery(). |
|
|
Return true if this compare is closed.
Definition at line 678 of file Connection.java. References com.quadcap.sql.Connection.file. |
|
|
Return true if this connection is read-only.
Definition at line 685 of file Connection.java. References com.quadcap.sql.Connection.readOnly. |
|
|
Definition at line 620 of file Connection.java. References com.quadcap.sql.Connection.db. |
|
|
Make a new (temporary) btree structure in the current database.
Definition at line 613 of file Connection.java. References com.quadcap.sql.Connection.db. Referenced by com.quadcap.sql.Session.makeTempTree(). |
|
|
Return (lazy create) the current Transaction.
Definition at line 429 of file Connection.java. References com.quadcap.sql.Connection.checkAborted(), com.quadcap.sql.Connection.connLock, com.quadcap.sql.Connection.db, com.quadcap.sql.Connection.fileLock, com.quadcap.sql.Connection.trans, com.quadcap.sql.Connection.transId, and com.quadcap.sql.Connection.writeLog. Referenced by com.quadcap.sql.Connection.getDbLock(), and com.quadcap.sql.Session.makeTransaction(). |
|
||||||||||||
|
Add a new statement context.
Definition at line 638 of file Connection.java. References com.quadcap.sql.Connection.putContext(), and com.quadcap.sql.Connection.transContext. Referenced by com.quadcap.sql.Session.putContext(), and com.quadcap.sql.Connection.putContext(). |
|
|
At transaction end, release our cached locks. PRECONDITION: connLock monitor entered Definition at line 519 of file Connection.java. References com.quadcap.sql.Connection.db_IS, com.quadcap.sql.Connection.db_IX, com.quadcap.sql.Connection.readOnly, com.quadcap.sql.Connection.rlocks, com.quadcap.sql.Connection.toString(), com.quadcap.sql.Connection.trans, com.quadcap.sql.Connection.transId, and com.quadcap.sql.Connection.wlocks. Referenced by com.quadcap.sql.Connection.abort(), com.quadcap.sql.Connection.endTransaction(), and com.quadcap.sql.Connection.rollbackTransaction(). |
|
|
Definition at line 147 of file Connection.java. References com.quadcap.sql.Connection.nextSession, com.quadcap.sql.Connection.removeSession(), com.quadcap.sql.Session.sessionIndex, and com.quadcap.sql.Connection.sessions. Referenced by com.quadcap.sql.Session.close(), and com.quadcap.sql.Connection.removeSession(). |
|
||||||||||||
|
Return a fully qualified column name. Column: <schema>. Definition at line 230 of file Connection.java. References com.quadcap.sql.Connection.auth, com.quadcap.sql.Tuple.getName(), and com.quadcap.sql.Connection.resolveColname(). Referenced by com.quadcap.sql.TupleImpl.addColumns(), com.quadcap.sql.IndexCursor.getCursorRange(), and com.quadcap.sql.Connection.resolveColname(). |
|
|
|
Statement rollback.
Definition at line 396 of file Connection.java. References com.quadcap.sql.Connection.checkAborted(), com.quadcap.sql.Connection.connLock, com.quadcap.sql.Connection.db, com.quadcap.sql.Connection.fileLock, com.quadcap.sql.Connection.rollbackStatement(), and com.quadcap.sql.Connection.trans. Referenced by com.quadcap.sql.Session.rollbackStatement(), and com.quadcap.sql.Connection.rollbackStatement(). |
|
|
Roll back this transaction. Toss the pending lists (and statement contexts, right? XXX), close any cursors and get the database to undo anything we've actually done to the database. Definition at line 358 of file Connection.java. References com.quadcap.sql.Connection.connLock, com.quadcap.sql.Connection.db, com.quadcap.sql.Connection.fileLock, com.quadcap.sql.Connection.releaseLocks(), com.quadcap.sql.Connection.toString(), com.quadcap.sql.Connection.trans, and com.quadcap.sql.Connection.transContext. Referenced by com.quadcap.sql.Connection.close(), and com.quadcap.sql.Connection.endStatement(). |
|
||||||||||||
|
Set the current authorization code.
Definition at line 595 of file Connection.java. References com.quadcap.sql.Connection.auth, com.quadcap.sql.Database.checkAuth(), com.quadcap.sql.Connection.db, and com.quadcap.sql.Connection.setAuth(). Referenced by com.quadcap.sql.Connection.Connection(), com.quadcap.sql.SQLParser.createSchemaStmt(), and com.quadcap.sql.Connection.setAuth(). |
|
|
Public setter for the 'autoCommit' flag.
Definition at line 540 of file Connection.java. References com.quadcap.sql.Connection.autoCommit, and com.quadcap.sql.Connection.setAutoCommit(). Referenced by com.quadcap.sql.tools.Loader.execute(), com.quadcap.sql.tools.Loader.loadStream(), and com.quadcap.sql.Connection.setAutoCommit(). |
|
|
Definition at line 700 of file Connection.java. References com.quadcap.sql.Connection.lastInsertId, and com.quadcap.sql.Connection.setLastInsertId(). Referenced by com.quadcap.sql.Session.setLastInsertId(), and com.quadcap.sql.Connection.setLastInsertId(). |
|
|
|
|
Definition at line 81 of file Connection.java. Referenced by com.quadcap.sql.Connection.close(), com.quadcap.sql.Connection.endStatement(), com.quadcap.sql.Connection.getAutoCommit(), and com.quadcap.sql.Connection.setAutoCommit(). |
|
|
|
|
Definition at line 87 of file Connection.java. Referenced by com.quadcap.sql.Connection.getDbLock(), and com.quadcap.sql.Connection.releaseLocks(). |
|
|
Definition at line 88 of file Connection.java. Referenced by com.quadcap.sql.Connection.getDbLock(), and com.quadcap.sql.Connection.releaseLocks(). |
|
|
Definition at line 83 of file Connection.java. Referenced by com.quadcap.sql.Connection.Connection(), com.quadcap.sql.Connection.getFile(), and com.quadcap.sql.Connection.isClosed(). |
|
|
Definition at line 73 of file Connection.java. Referenced by com.quadcap.sql.Connection.endTransaction(), com.quadcap.sql.Connection.makeTransaction(), com.quadcap.sql.Connection.rollbackStatement(), and com.quadcap.sql.Connection.rollbackTransaction(). |
|
|
Definition at line 100 of file Connection.java. |
|
|
Definition at line 96 of file Connection.java. Referenced by com.quadcap.sql.Connection.close(). |
|
|
Definition at line 101 of file Connection.java. Referenced by com.quadcap.sql.Connection.Connection(). |
|
|
Definition at line 98 of file Connection.java. Referenced by com.quadcap.sql.Connection.getLastInsertId(), and com.quadcap.sql.Connection.setLastInsertId(). |
|
|
Definition at line 95 of file Connection.java. Referenced by com.quadcap.sql.Connection.closeSessions(), com.quadcap.sql.Connection.createSession(), and com.quadcap.sql.Connection.removeSession(). |
|
|
Definition at line 91 of file Connection.java. Referenced by com.quadcap.sql.Connection.getRandom(). |
|
|
|
Definition at line 84 of file Connection.java. Referenced by com.quadcap.sql.Connection.getTableReadLock(), and com.quadcap.sql.Connection.releaseLocks(). |
|
|
Definition at line 94 of file Connection.java. Referenced by com.quadcap.sql.Connection.closeSessions(), com.quadcap.sql.Connection.createSession(), com.quadcap.sql.Connection.getSession(), and com.quadcap.sql.Connection.removeSession(). |
|
|
|
Definition at line 76 of file Connection.java. Referenced by com.quadcap.sql.Connection.abort(), and com.quadcap.sql.Connection.checkAborted(). |
|
|
|
Definition at line 77 of file Connection.java. Referenced by com.quadcap.sql.Database.getSession(), com.quadcap.sql.Connection.getTransactionId(), com.quadcap.sql.Connection.makeTransaction(), and com.quadcap.sql.Connection.releaseLocks(). |