|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbe.SIRAPRISE.client.DBTransaction
public class DBTransaction
A DBTransaction represents the transaction that is active on some DBConnection.
Method Summary | |
---|---|
void |
commit()
Commits this non-autocommit transaction. |
AbstractRelation |
compileAndCacheQuery(java.lang.String query)
Sends a query expression to the server for compilation-and-caching. |
AbstractRelation |
compileQuery(java.lang.String query)
Sends a query expression to the server for verification only. |
void |
dbAdd(java.lang.String relvarName,
DBObject o)
Adds an entry in the named relvar (in the database the transaction is connected to), for the given object. |
void |
dbAddAndEndTransaction(java.lang.String relvarName,
DBObject o)
Adds an entry in the named relvar (in the database the transaction is connected to), for the given object. |
DmlAddCommand |
dbAddCommand(java.lang.String relvarName,
DBObject o)
Gets the command for adding an entry in the named relvar (in the database the transaction is connected to), for the given object. |
void |
dbAssert(java.lang.String relvarName,
DBObject o)
Asserts an entry in the named relvar (in the database the transaction is connected to), for the given object. |
void |
dbAssertAndEndTransaction(java.lang.String relvarName,
DBObject o)
Asserts an entry in the named relvar (in the database the transaction is connected to), for the given object. |
DmlAssertCommand |
dbAssertCommand(java.lang.String relvarName,
DBObject o)
Gets the Assert command for asserting an entry in the named relvar (in the database the transaction is connected to), for the given object. |
void |
dbDelete(java.lang.String relvarName,
DBObject o)
Deletes an entry in the named relvar (in the database the transaction is connected to), for the given object. |
void |
dbDeleteAndEndTransaction(java.lang.String relvarName,
DBObject o)
Deletes an entry in the named relvar (in the database the transaction is connected to), for the given object. |
DmlDeleteCommand |
dbDeleteCommand(java.lang.String relvarName,
DBObject o)
Gets the command for deleting the tuple in the named relvar (in the database the transaction is connected to), for the given object. |
void |
dbUnAssert(java.lang.String relvarName,
DBObject o)
Unasserts an entry in the named relvar (in the database the transaction is connected to), for the given object. |
void |
dbUnAssertAndEndTransaction(java.lang.String relvarName,
DBObject o)
Unasserts an entry in the named relvar (in the database the transaction is connected to), for the given object. |
DmlUnassertCommand |
dbUnAssertCommand(java.lang.String relvarName,
DBObject o)
Gets the command for unasserting the tuple in the named relvar (in the database the transaction is connected to), for the given object. |
void |
dbUpdate(java.lang.String relvarName,
UpdatableDBObject o)
Updates an entry in the named relvar (in the database the transaction is connected to), for the given object. |
void |
dbUpdateAndEndTransaction(java.lang.String relvarName,
UpdatableDBObject o)
Updates an entry in the named relvar (in the database the transaction is connected to), for the given object. |
DmlUpdateCommand |
dbUpdateCommand(java.lang.String relvarName,
UpdatableDBObject o)
Gets the command for Updating an entry in the named relvar (in the database the transaction is connected to), for the given object. |
void |
end(boolean commit)
Ends the transaction, issuing either a commit or a rollback. |
AbstractRelation |
execDmlCommand(DmlCommand command)
Sends a command to the server and returns the result obtained. |
AbstractRelation |
execDmlCommand(ServerCommand serverCommand)
Sends a command to the server and returns the result obtained. |
AbstractRelation |
execDmlCommand(java.lang.String cmd)
Sends a command to the server and returns the result obtained. |
AbstractRelation |
execDmlCommandAndEndTransaction(DmlCommand command)
Sends a command to the server and returns the result obtained. |
AbstractRelation |
execDmlCommandAndEndTransaction(ServerCommand serverCommand)
Sends a command to the server and returns the result obtained. |
AbstractRelation |
execDmlCommandAndEndTransaction(java.lang.String cmd)
Sends a command to the server and returns the result obtained. |
AbstractRelation |
execMultipleStatement(java.util.Collection<? extends java.lang.Object> commands)
Executes a series of single-assignment commands as a multiple-assignment command. |
AbstractRelation |
execMultipleStatement(DmlAssignmentCommand[] commands)
Executes a series of single-assignment commands as a multiple-assignment command. |
AbstractRelation |
execMultipleStatement(java.lang.String[] commands)
Executes a series of single-assignment commands as a multiple-assignment command. |
AbstractRelation |
execMultipleStatementAndEndTransaction(java.util.Collection<? extends java.lang.Object> commands)
Executes a series of single-assignment commands as a multiple-assignment command. |
AbstractRelation |
execMultipleStatementAndEndTransaction(DmlAssignmentCommand[] commands)
Executes a series of single-assignment commands as a multiple-assignment command. |
AbstractRelation |
execMultipleStatementAndEndTransaction(java.lang.String[] commands)
Executes a series of single-assignment commands as a multiple-assignment command. |
AbstractRelation[] |
execQueries(java.lang.String[] expression)
Executes a series of inquire commands on the server. |
AbstractRelation[] |
execQueriesAndEndTransaction(java.lang.String[] expression)
Executes a series of inquire commands on the server. |
AbstractRelation |
execQuery(java.lang.String expression)
Executes an inquire command on the server. |
AbstractRelation |
execQueryAndEndTransaction(java.lang.String expression)
Executes an inquire command on the server. |
DBTransaction |
getParentTransaction()
Gets The "parent" transaction of this nested transaction, or null if this is not a nested transaction |
long |
getTransactionID()
Gets The numerical server-side ID of the started transaction, or -1 if the server is pre 1.2 |
boolean |
isAutoCommit()
Gets the flag indicating whether all DML statements executed in the transaction should be automatically committed |
boolean |
isReadOnly()
Gets the Flag indicating whether the transaction is read-only |
void |
rollback()
Commits this non-autocommit transaction. |
DBTransaction |
savePoint()
Takes a savepoint in the current transaction. |
DBTransaction |
startNestedTransaction(boolean newAutoCommit,
boolean readOnly)
Starts a nested transaction within this transaction. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public final void commit() throws ConnectionClosedException
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server, or if the commit failed.public final AbstractRelation compileAndCacheQuery(java.lang.String query) throws ConnectionClosedException, ErrorMessageException
query
- the query to be compiled-and-cached, in textual form.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation compileQuery(java.lang.String query) throws ConnectionClosedException, ErrorMessageException
query
- the query to be verified, in textual form.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final void dbAdd(java.lang.String relvarName, DBObject o) throws ConnectionClosedException, ErrorMessageException
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final void dbAddAndEndTransaction(java.lang.String relvarName, DBObject o) throws ConnectionClosedException, ErrorMessageException
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final DmlAddCommand dbAddCommand(java.lang.String relvarName, DBObject o)
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn.
public final void dbAssert(java.lang.String relvarName, DBObject o) throws ConnectionClosedException, ErrorMessageException
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final void dbAssertAndEndTransaction(java.lang.String relvarName, DBObject o) throws ConnectionClosedException, ErrorMessageException
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final DmlAssertCommand dbAssertCommand(java.lang.String relvarName, DBObject o)
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn.
public final void dbDelete(java.lang.String relvarName, DBObject o) throws ConnectionClosedException, ErrorMessageException
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final void dbDeleteAndEndTransaction(java.lang.String relvarName, DBObject o) throws ConnectionClosedException, ErrorMessageException
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final DmlDeleteCommand dbDeleteCommand(java.lang.String relvarName, DBObject o)
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn.
public final void dbUnAssert(java.lang.String relvarName, DBObject o) throws ConnectionClosedException, ErrorMessageException
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final void dbUnAssertAndEndTransaction(java.lang.String relvarName, DBObject o) throws ConnectionClosedException, ErrorMessageException
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final DmlUnassertCommand dbUnAssertCommand(java.lang.String relvarName, DBObject o)
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn.
public final void dbUpdate(java.lang.String relvarName, UpdatableDBObject o) throws ConnectionClosedException, ErrorMessageException
The updates carried out are determined as follows : For each attribute in the tuple, the value for that attribute (obtained through invoking its getter method on the object) is compared to the pre-update value of that attribute (this value is obtained by invoking the same getter method on the result of the getPreUpdateState() method invocation on the object). If those are equal, nothing is done. If those values are unequal, then an entry is inserted in the update command to make sure the update for the attribute value will happen.
After a successful update, the setPreUpdateState() method in o is invoked to make that preUpdateState accurately reflect the current database state.
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn. // *
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final void dbUpdateAndEndTransaction(java.lang.String relvarName, UpdatableDBObject o) throws ConnectionClosedException, ErrorMessageException
The updates carried out are determined as follows : For each attribute in the tuple, the value for that attribute (obtained through invoking its getter method on the object) is compared to the pre-update value of that attribute (this value is obtained by invoking the same getter method on the result of the getPreUpdateState() method invocation on the object). If those are equal, nothing is done. If those values are unequal, then an entry is inserted in the update command to make sure the update for the attribute value will happen.
After a successful update, the setPreUpdateState() method in o is invoked to make that preUpdateState accurately reflect the current database state.
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn. // *
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final DmlUpdateCommand dbUpdateCommand(java.lang.String relvarName, UpdatableDBObject o) throws NoUpdatesException
relvarName
- The name of the relvar into which a tuple is to be added for the given objecto
- The object from which the tuple to be registered in the named relvar is to be drawn. // *
NoUpdatesException
- if no attribute value changes at all are detectedpublic final void end(boolean commit) throws ConnectionClosedException
commit
- true if the transaction is to be committed, false if it is to be rolled back.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the serverpublic final AbstractRelation execDmlCommand(DmlCommand command) throws ConnectionClosedException, ErrorMessageException
command
- the command to be executed, in textual form.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execDmlCommand(ServerCommand serverCommand) throws ConnectionClosedException, ErrorMessageException
serverCommand
- the command to be executed.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execDmlCommand(java.lang.String cmd) throws ConnectionClosedException, ErrorMessageException
cmd
- the command to be executed, in textual form.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execDmlCommandAndEndTransaction(DmlCommand command) throws ConnectionClosedException, ErrorMessageException
command
- the command to be executed, in textual form.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execDmlCommandAndEndTransaction(ServerCommand serverCommand) throws ConnectionClosedException, ErrorMessageException
serverCommand
- the command to be executed.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execDmlCommandAndEndTransaction(java.lang.String cmd) throws ConnectionClosedException, ErrorMessageException
cmd
- the command to be executed, in textual form.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execMultipleStatement(java.util.Collection<? extends java.lang.Object> commands) throws ConnectionClosedException, ErrorMessageException
commands
- The commands to be executed. Execution is in the obvious order, and thus not randomly, or in reverse order, or whatever.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execMultipleStatement(DmlAssignmentCommand[] commands) throws ConnectionClosedException, ErrorMessageException
commands
- The single-assignment commands to be executed. Execution is in the obvious order, and thus not randomly, or in reverse order, or whatever.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execMultipleStatement(java.lang.String[] commands) throws ConnectionClosedException, ErrorMessageException
commands
- The single-assignment commands to be executed. Execution is in the obvious order, and thus not randomly, or in reverse order, or whatever.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execMultipleStatementAndEndTransaction(java.util.Collection<? extends java.lang.Object> commands) throws ConnectionClosedException, ErrorMessageException
commands
- The commands to be executed. Execution is in the obvious order, and thus not randomly, or in reverse order, or whatever.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execMultipleStatementAndEndTransaction(DmlAssignmentCommand[] commands) throws ConnectionClosedException, ErrorMessageException
commands
- The single-assignment commands to be executed. Execution is in the obvious order, and thus not randomly, or in reverse order, or whatever.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execMultipleStatementAndEndTransaction(java.lang.String[] commands) throws ConnectionClosedException, ErrorMessageException
commands
- The single-assignment commands to be executed. Execution is in the obvious order, and thus not randomly, or in reverse order, or whatever.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation[] execQueries(java.lang.String[] expression) throws ConnectionClosedException, ErrorMessageException
expression
- The expressions of the relational algebra to be inquired.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation[] execQueriesAndEndTransaction(java.lang.String[] expression) throws ConnectionClosedException, ErrorMessageException
expression
- The expressions of the relational algebra to be inquired.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execQuery(java.lang.String expression) throws ConnectionClosedException, ErrorMessageException
expression
- The expression of the relational algebra to be inquired.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final AbstractRelation execQueryAndEndTransaction(java.lang.String expression) throws ConnectionClosedException, ErrorMessageException
expression
- The expression of the relational algebra to be inquired.
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the server
ErrorMessageException
- If the response obtained from the server is not a commit confirmation, but an error response instead.public final DBTransaction getParentTransaction()
public final long getTransactionID()
public final boolean isAutoCommit()
public final boolean isReadOnly()
public final void rollback() throws ConnectionClosedException
ConnectionClosedException
- If the connection was closed due to an I/O error that occurred during communication with the serverpublic final DBTransaction savePoint() throws ErrorMessageException, ConnectionClosedException
ConnectionClosedException
ErrorMessageException
public final DBTransaction startNestedTransaction(boolean newAutoCommit, boolean readOnly) throws ErrorMessageException, ConnectionClosedException
newAutoCommit
- The autocommit setting for the new transaction nested inside the current onereadOnly
- The readOnly setting for the new transaction nested inside the current one. May only be false if this transaction is not read-only too.
ConnectionClosedException
ErrorMessageException
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |