be.SIRAPRISE.client
Class DBTransaction

java.lang.Object
  extended by be.SIRAPRISE.client.DBTransaction

public class DBTransaction
extends java.lang.Object

A DBTransaction represents the transaction that is active on some DBConnection.

Author:
Erwin Smout

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

commit

public final void commit()
                  throws ConnectionClosedException
Commits this non-autocommit transaction. If the transaction is auto-commit, this method is a NOP.

Throws:
ConnectionClosedException - If the connection was closed due to an I/O error that occurred during communication with the server, or if the commit failed.

compileAndCacheQuery

public final AbstractRelation compileAndCacheQuery(java.lang.String query)
                                            throws ConnectionClosedException,
                                                   ErrorMessageException
Sends a query expression to the server for compilation-and-caching.

Parameters:
query - the query to be compiled-and-cached, in textual form.
Returns:
the result of the compilation. That result is a relation with the following attributes :
  • QUERYID(LONG(...)) The internal ID of the compiled query, by which the query can later be referenced
  • HEADING(RELATION(...)) The description of the heading of the relation as it will be output by the query
  • PARMS(RELATION(...)) The description of all parameters required by the query
The heading of the 'HEADING' relation is as follows :
  • ATTRIBUTENAME(NAME(...)) The name of an attribute in the output of the query
  • TYPENAME(NAME(...)) The name of the type of that attribute in the output of the query
The heading of the 'PARMS' relation is as follows :
  • PARAMETERNAME(NAME(...)) The name of a parameter required by the query
  • TYPENAME(NAME(...)) The name of the type of that parameter
Throws:
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.

compileQuery

public final AbstractRelation compileQuery(java.lang.String query)
                                    throws ConnectionClosedException,
                                           ErrorMessageException
Sends a query expression to the server for verification only.

Parameters:
query - the query to be verified, in textual form.
Returns:
the result of the verification. That result is a relation with the following attributes :
  1. HEADING(RELATION(...)) The description of the heading of the relation as it will be output by the query
  2. PARMS(RELATION(...)) The description of all parameters required by the query
The heading of the 'HEADING' relation is as follows :
  1. ATTRIBUTENAME(NAME(...)) The name of an attribute in the output of the query
  2. TYPENAME(NAME(...)) The name of the type of that attribute in the output of the query
The heading of the 'PARMS' relation is as follows :
  1. PARAMETERNAME(NAME(...)) The name of a parameter required by the query
  2. TYPENAME(NAME(...)) The name of the type of that parameter
Throws:
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.

dbAdd

public final void dbAdd(java.lang.String relvarName,
                        DBObject o)
                 throws ConnectionClosedException,
                        ErrorMessageException
Adds an entry in the named relvar (in the database the transaction is connected to), for the given object. The tuple that is registered in the database is constructed by invoking all the object's methods that satisfy the following properties :

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn.
Throws:
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.

dbAddAndEndTransaction

public final void dbAddAndEndTransaction(java.lang.String relvarName,
                                         DBObject o)
                                  throws ConnectionClosedException,
                                         ErrorMessageException
Adds an entry in the named relvar (in the database the transaction is connected to), for the given object. The tuple that is registered in the database is constructed by invoking all the object's methods that satisfy the following properties :

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn.
Throws:
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.

dbAddCommand

public final 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. The tuple that is registered in the database is constructed by invoking all the object's methods that satisfy the following properties :

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn.
Returns:
The add command to be issued for adding an entry in the named relvar with attribute values drawn from the given object

dbAssert

public final void dbAssert(java.lang.String relvarName,
                           DBObject o)
                    throws ConnectionClosedException,
                           ErrorMessageException
Asserts an entry in the named relvar (in the database the transaction is connected to), for the given object. The tuple that is registered in the database is constructed by invoking all the object's methods that satisfy the following properties :

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn.
Throws:
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.

dbAssertAndEndTransaction

public final void dbAssertAndEndTransaction(java.lang.String relvarName,
                                            DBObject o)
                                     throws ConnectionClosedException,
                                            ErrorMessageException
Asserts an entry in the named relvar (in the database the transaction is connected to), for the given object. The tuple that is registered in the database is constructed by invoking all the object's methods that satisfy the following properties :

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn.
Throws:
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.

dbAssertCommand

public final 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. The tuple that is registered in the database is constructed by invoking all the object's methods that satisfy the following properties :

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn.
Returns:
The assert command to be issued for adding an entry in the named relvar with attribute values drawn from the given object

dbDelete

public final void dbDelete(java.lang.String relvarName,
                           DBObject o)
                    throws ConnectionClosedException,
                           ErrorMessageException
Deletes an entry in the named relvar (in the database the transaction is connected to), for the given object. The tuple that is registered in the database is constructed by invoking all the object's methods that satisfy the following properties :

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn.
Throws:
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.

dbDeleteAndEndTransaction

public final void dbDeleteAndEndTransaction(java.lang.String relvarName,
                                            DBObject o)
                                     throws ConnectionClosedException,
                                            ErrorMessageException
Deletes an entry in the named relvar (in the database the transaction is connected to), for the given object. The tuple that is registered in the database is constructed by invoking all the object's methods that satisfy the following properties : After the deletion has been carried out, the transaction is ended

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn.
Throws:
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.

dbDeleteCommand

public final 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. The tuple that is registered in the database is constructed by invoking all the object's methods that satisfy the following properties :

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn.
Returns:
the command for deleting the tuple in the named relvar (in the database the transaction is connected to), for the given object.

dbUnAssert

public final void dbUnAssert(java.lang.String relvarName,
                             DBObject o)
                      throws ConnectionClosedException,
                             ErrorMessageException
Unasserts an entry in the named relvar (in the database the transaction is connected to), for the given object. The tuple that is registered in the database is constructed by invoking all the object's methods that satisfy the following properties :

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn.
Throws:
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.

dbUnAssertAndEndTransaction

public final void dbUnAssertAndEndTransaction(java.lang.String relvarName,
                                              DBObject o)
                                       throws ConnectionClosedException,
                                              ErrorMessageException
Unasserts an entry in the named relvar (in the database the transaction is connected to), for the given object. The tuple that is registered in the database is constructed by invoking all the object's methods that satisfy the following properties :

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn.
Throws:
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.

dbUnAssertCommand

public final 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. The tuple that is registered in the database is constructed by invoking all the object's methods that satisfy the following properties :

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn.
Returns:
the command for unasserting the tuple in the named relvar (in the database the transaction is connected to), for the given object.

dbUpdate

public final void dbUpdate(java.lang.String relvarName,
                           UpdatableDBObject o)
                    throws ConnectionClosedException,
                           ErrorMessageException
Updates an entry in the named relvar (in the database the transaction is connected to), for the given object. The tuple that is updated in the database is constructed by invoking all the object's methods that satisfy the following properties :

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.

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn. // *
Throws:
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.

dbUpdateAndEndTransaction

public final void dbUpdateAndEndTransaction(java.lang.String relvarName,
                                            UpdatableDBObject o)
                                     throws ConnectionClosedException,
                                            ErrorMessageException
Updates an entry in the named relvar (in the database the transaction is connected to), for the given object. The tuple that is updated in the database is constructed by invoking all the object's methods that satisfy the following properties :

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.

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn. // *
Throws:
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.

dbUpdateCommand

public final DmlUpdateCommand dbUpdateCommand(java.lang.String relvarName,
                                              UpdatableDBObject o)
                                       throws NoUpdatesException
Gets the command for Updating an entry in the named relvar (in the database the transaction is connected to), for the given object. The tuple that is updated in the database is constructed by invoking all the object's methods that satisfy the following properties : 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.

Parameters:
relvarName - The name of the relvar into which a tuple is to be added for the given object
o - The object from which the tuple to be registered in the named relvar is to be drawn. // *
Returns:
the command for Updating an entry in the named relvar (in the database the transaction is connected to), for the given object.
Throws:
NoUpdatesException - if no attribute value changes at all are detected

end

public final void end(boolean commit)
               throws ConnectionClosedException
Ends the transaction, issuing either a commit or a rollback.

Parameters:
commit - true if the transaction is to be committed, false if it is to be rolled back.
Throws:
ConnectionClosedException - If the connection was closed due to an I/O error that occurred during communication with the server

execDmlCommand

public final AbstractRelation execDmlCommand(DmlCommand command)
                                      throws ConnectionClosedException,
                                             ErrorMessageException
Sends a command to the server and returns the result obtained.

Parameters:
command - the command to be executed, in textual form.
Returns:
the result of the command.
Throws:
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.

execDmlCommand

public final AbstractRelation execDmlCommand(ServerCommand serverCommand)
                                      throws ConnectionClosedException,
                                             ErrorMessageException
Sends a command to the server and returns the result obtained.

Parameters:
serverCommand - the command to be executed.
Returns:
the result of the command.
Throws:
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.

execDmlCommand

public final AbstractRelation execDmlCommand(java.lang.String cmd)
                                      throws ConnectionClosedException,
                                             ErrorMessageException
Sends a command to the server and returns the result obtained.

Parameters:
cmd - the command to be executed, in textual form.
Returns:
the result of the command.
Throws:
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.

execDmlCommandAndEndTransaction

public final AbstractRelation execDmlCommandAndEndTransaction(DmlCommand command)
                                                       throws ConnectionClosedException,
                                                              ErrorMessageException
Sends a command to the server and returns the result obtained.

Parameters:
command - the command to be executed, in textual form.
Returns:
the result of the command.
Throws:
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.

execDmlCommandAndEndTransaction

public final AbstractRelation execDmlCommandAndEndTransaction(ServerCommand serverCommand)
                                                       throws ConnectionClosedException,
                                                              ErrorMessageException
Sends a command to the server and returns the result obtained.

Parameters:
serverCommand - the command to be executed.
Returns:
the result of the command.
Throws:
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.

execDmlCommandAndEndTransaction

public final AbstractRelation execDmlCommandAndEndTransaction(java.lang.String cmd)
                                                       throws ConnectionClosedException,
                                                              ErrorMessageException
Sends a command to the server and returns the result obtained. After execution of the command, the transaction is committed and ended.

Parameters:
cmd - the command to be executed, in textual form.
Returns:
The result of executing the command. Null if the command is an assignment command.
Throws:
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.

execMultipleStatement

public final AbstractRelation execMultipleStatement(java.util.Collection<? extends java.lang.Object> commands)
                                             throws ConnectionClosedException,
                                                    ErrorMessageException
Executes a series of single-assignment commands as a multiple-assignment command. Optionally closes the connection immediately after succesfull execution of the series of assignments. If the result indicates any kind of error, then the connection will be closed.

Parameters:
commands - The commands to be executed. Execution is in the obvious order, and thus not randomly, or in reverse order, or whatever.
Returns:
the DBResponse obtained.
Throws:
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.

execMultipleStatement

public final AbstractRelation execMultipleStatement(DmlAssignmentCommand[] commands)
                                             throws ConnectionClosedException,
                                                    ErrorMessageException
Executes a series of single-assignment commands as a multiple-assignment command. If the result indicates any kind of error, then the connection will be closed.

Parameters:
commands - The single-assignment commands to be executed. Execution is in the obvious order, and thus not randomly, or in reverse order, or whatever.
Returns:
the DBResponse obtained.
Throws:
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.

execMultipleStatement

public final AbstractRelation execMultipleStatement(java.lang.String[] commands)
                                             throws ConnectionClosedException,
                                                    ErrorMessageException
Executes a series of single-assignment commands as a multiple-assignment command. If the result indicates any kind of error, then the connection will be closed.

Parameters:
commands - The single-assignment commands to be executed. Execution is in the obvious order, and thus not randomly, or in reverse order, or whatever.
Returns:
the DBResponse obtained.
Throws:
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.

execMultipleStatementAndEndTransaction

public final AbstractRelation execMultipleStatementAndEndTransaction(java.util.Collection<? extends java.lang.Object> commands)
                                                              throws ConnectionClosedException,
                                                                     ErrorMessageException
Executes a series of single-assignment commands as a multiple-assignment command.

Parameters:
commands - The commands to be executed. Execution is in the obvious order, and thus not randomly, or in reverse order, or whatever.
Returns:
the DBResponse obtained.
Throws:
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.

execMultipleStatementAndEndTransaction

public final AbstractRelation execMultipleStatementAndEndTransaction(DmlAssignmentCommand[] commands)
                                                              throws ConnectionClosedException,
                                                                     ErrorMessageException
Executes a series of single-assignment commands as a multiple-assignment command.

Parameters:
commands - The single-assignment commands to be executed. Execution is in the obvious order, and thus not randomly, or in reverse order, or whatever.
Returns:
the DBResponse obtained.
Throws:
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.

execMultipleStatementAndEndTransaction

public final AbstractRelation execMultipleStatementAndEndTransaction(java.lang.String[] commands)
                                                              throws ConnectionClosedException,
                                                                     ErrorMessageException
Executes a series of single-assignment commands as a multiple-assignment command.

Parameters:
commands - The single-assignment commands to be executed. Execution is in the obvious order, and thus not randomly, or in reverse order, or whatever.
Returns:
the DBResponse obtained.
Throws:
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.

execQueries

public final AbstractRelation[] execQueries(java.lang.String[] expression)
                                     throws ConnectionClosedException,
                                            ErrorMessageException
Executes a series of inquire commands on the server.

Parameters:
expression - The expressions of the relational algebra to be inquired.
Returns:
response A DBResponse array holding the values of the corresponding queried expressions.
Throws:
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.

execQueriesAndEndTransaction

public final AbstractRelation[] execQueriesAndEndTransaction(java.lang.String[] expression)
                                                      throws ConnectionClosedException,
                                                             ErrorMessageException
Executes a series of inquire commands on the server.

Parameters:
expression - The expressions of the relational algebra to be inquired.
Returns:
response A DBResponse array holding the values of the corresponding queried expressions.
Throws:
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.

execQuery

public final AbstractRelation execQuery(java.lang.String expression)
                                 throws ConnectionClosedException,
                                        ErrorMessageException
Executes an inquire command on the server. If the result indicates any kind of error, then the connection will be closed.

Parameters:
expression - The expression of the relational algebra to be inquired.
Returns:
response A DBResponse holding the value of the queried expression.
Throws:
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.

execQueryAndEndTransaction

public final AbstractRelation execQueryAndEndTransaction(java.lang.String expression)
                                                  throws ConnectionClosedException,
                                                         ErrorMessageException
Executes an inquire command on the server. Optionally closes the connection immediately after succesfull execution of the query. If the result indicates any kind of error, then the connection will be closed.

Parameters:
expression - The expression of the relational algebra to be inquired.
Returns:
response A DBResponse holding the value of the queried expression.
Throws:
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.

getParentTransaction

public final DBTransaction getParentTransaction()
Gets The "parent" transaction of this nested transaction, or null if this is not a nested transaction

Returns:
The "parent" transaction of this nested transaction, or null if this is not a nested transaction

getTransactionID

public final long getTransactionID()
Gets The numerical server-side ID of the started transaction, or -1 if the server is pre 1.2

Returns:
The numerical server-side ID of the started transaction, or -1 if the server is pre 1.2

isAutoCommit

public final boolean isAutoCommit()
Gets the flag indicating whether all DML statements executed in the transaction should be automatically committed

Returns:
true if all DML statements executed in the transaction should be automatically committed

isReadOnly

public final boolean isReadOnly()
Gets the Flag indicating whether the transaction is read-only

Returns:
Flag indicating whether the transaction is read-only

rollback

public final void rollback()
                    throws ConnectionClosedException
Commits this non-autocommit transaction. If the transaction is auto-commit, this method is a NOP.

Throws:
ConnectionClosedException - If the connection was closed due to an I/O error that occurred during communication with the server

savePoint

public final DBTransaction savePoint()
                              throws ErrorMessageException,
                                     ConnectionClosedException
Takes a savepoint in the current transaction. Rolling back to this savepoint is done by invoking the rollback() method on the DBTransaction object returned by this method invocation. Rolling back to this savepoint AND discarding it, is done by invoking the endTransaction(false) method on the DBTransaction object returned from this method.

Returns:
A DBTransaction object representing the new "nested" transaction that is started on the server side and that will span all activities done on the server from this point on.
Throws:
ConnectionClosedException
ErrorMessageException

startNestedTransaction

public final DBTransaction startNestedTransaction(boolean newAutoCommit,
                                                  boolean readOnly)
                                           throws ErrorMessageException,
                                                  ConnectionClosedException
Starts a nested transaction within this transaction.

Parameters:
newAutoCommit - The autocommit setting for the new transaction nested inside the current one
readOnly - The readOnly setting for the new transaction nested inside the current one. May only be false if this transaction is not read-only too.
Returns:
A DBTransaction object representing the new "nested" transaction that is started on the server side and that will span all activities done on the server from this point on.
Throws:
ConnectionClosedException
ErrorMessageException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object