public class DBTransactionStatement extends DBStatement
Use DBScript to easily create a transaction.
You should not need to create on of these as statements and transactions are managed by DBDatabase automatically.
Transactions are a collection of database actions that have a coherent collective nature. This implies that even though they are separate java statements that they should be handled collectively by the database.
Support DBvolution at Patreon
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO| Constructor and Description |
|---|
DBTransactionStatement(DBDatabase database,
DBStatement statement)
Creates a DBTransactionStatement for the given DBDatabase and DBStatement.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels this Statement object if both the DBMS and driver support aborting
an SQL statement.
|
void |
close()
Closes the internal statement and creates a new statement for the next
operation.
|
void |
transactionFinished()
Performs actions required following the completion of a transaction.
|
addBatch, clearBatch, clearWarnings, closeOnCompletion, execute, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getBatchHasEntries, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getInternalStatement, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, replaceBrokenConnection, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setInternalStatement, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, unwrappublic DBTransactionStatement(DBDatabase database, DBStatement statement) throws SQLException
Used within DBDatabase.doTransaction(nz.co.gregs.dbvolution.transactions.DBTransaction) to create a transaction.
1 Database exceptions may be thrown
database - databasestatement - statementSQLException - java.sql.SQLExceptionpublic void close()
throws SQLException
To close a transaction call the transactionFinished() method.
close in interface AutoCloseableclose in interface Statementclose in class DBStatementSQLException - SQLExceptionpublic void cancel()
throws SQLException
DBStatementcancel in interface Statementcancel in class DBStatementSQLExceptionpublic void transactionFinished()
throws SQLException
Transactions last longer than the standard DBStatement so a new method is required to close their resources. 1 Database exceptions may be thrown
SQLException - java.sql.SQLExceptionCopyright © 2018. All Rights Reserved.