public class Transaction extends Object
Modifier and Type | Field and Description |
---|---|
static int |
COMMITTED
Status for committed transactions
|
static int |
OPENED
Status for opened transactions
|
static int |
ROLLEDBACK
Status for roll backed transactions
|
Constructor and Description |
---|
Transaction()
Constructor
|
Transaction(Plugin plugin)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
commit()
Commit the transaction
|
void |
executeStatement()
Execute the current statement
|
PreparedStatement |
getStatement()
The current prepared statement
|
int |
getStatus()
Return the transaction status
|
PreparedStatement |
prepareStatement(String strSQL)
Gets a prepared statement
|
PreparedStatement |
prepareStatement(String strSQL,
boolean bLogQueries)
Gets a prepared statement
|
PreparedStatement |
prepareStatement(String strSQL,
Integer autoGeneratedKeys)
Gets a prepared statement
|
PreparedStatement |
prepareStatement(String strSQL,
Integer autoGeneratedKeys,
boolean bLogQueries)
Gets a prepared statement
|
void |
rollback()
Rollback the transaction
|
void |
rollback(Exception e)
Rollback the transaction
|
public static final int OPENED
public static final int COMMITTED
public static final int ROLLEDBACK
public Transaction()
public Transaction(Plugin plugin)
plugin
- The plugin owner of the transactionpublic PreparedStatement prepareStatement(String strSQL) throws SQLException
strSQL
- The SQL statementSQLException
- If an SQL error occurspublic PreparedStatement prepareStatement(String strSQL, Integer autoGeneratedKeys) throws SQLException
strSQL
- The SQL statementSQLException
- If an SQL error occurspublic PreparedStatement prepareStatement(String strSQL, boolean bLogQueries) throws SQLException
strSQL
- The SQL statementSQLException
- If an SQL error occurspublic PreparedStatement prepareStatement(String strSQL, Integer autoGeneratedKeys, boolean bLogQueries) throws SQLException
strSQL
- The SQL statementautoGeneratedKeys
- a flag indicating whether auto-generated keys should be returned; For example one of Statement.RETURN_GENERATED_KEYS
or
Statement.NO_GENERATED_KEYS
. See PreparedStatement#prepareStatement(String, int)
SQLException
- If an SQL error occurspublic PreparedStatement getStatement()
public void executeStatement() throws SQLException
SQLException
- If an SQL error occurspublic void commit()
public void rollback()
public void rollback(Exception e)
e
- The exception that cause the rollbackpublic int getStatus()
Copyright © 2020 City of Paris. All rights reserved.