public class IfsConnection extends ConnectionWrapper
Constructor and Description |
---|
IfsConnection(S_LibrarySession session)
Constructs a ConnectionWrapper.
|
Modifier and Type | Method and Description |
---|---|
void |
commit()
Commit makes all changes made since the previous
commit/rollback permanent and releases any database locks
currently held by the ConnectionWrapper.
|
void |
commit(boolean force) |
protected CallableStatementWrapper |
constructCallableStatementWrapper(CallableStatement cstmt)
Constructs a CallableStatementWrapper.
|
protected PreparedStatementWrapper |
constructPreparedStatementWrapper(PreparedStatement pstmt)
Constructs a PreparedStatementWrapper.
|
protected StatementWrapper |
constructStatementWrapper(Statement stmt)
Constructs a StatementWrapper.
|
boolean |
execute(PreparedStatement pstmt)
Some prepared statements return multiple results; the execute
method handles these complex statements as well as the simpler
form of statements handled by executeQuery and executeUpdate.
|
boolean |
execute(Statement stmt,
String sql)
Execute a SQL statement that may return multiple results.
|
int[] |
executeBatch(Statement stmt)
Submits a batch of commands to the database for execution and if all
commands execute successfully, returns an array of update counts.
|
ResultSet |
executeQuery(PreparedStatement pstmt)
A prepared SQL query is executed and its ResultSet is returned.
|
ResultSet |
executeQuery(Statement stmt,
String sql)
Execute a SQL statement that returns a single ResultSet.
|
int |
executeUpdate(PreparedStatement pstmt)
Execute a SQL INSERT, UPDATE or DELETE statement.
|
int |
executeUpdate(Statement stmt,
String sql)
Execute a SQL INSERT, UPDATE or DELETE statement.
|
void |
rollback()
Rollback drops all changes made since the previous
commit/rollback and releases any database locks currently held
by the ConnectionWrapper.
|
void |
rollback(boolean force) |
void |
setAutoCommit(boolean autoCommit)
If a connection is in auto-commit mode, then all its SQL
statements will be executed and committed as individual
transactions.
|
void |
setCatalog(String catalog)
A sub-space of this ConnectionWrapper's database may be selected by setting a
catalog name.
|
void |
setReadOnly(boolean readOnly)
You can put a connection in read-only mode as a hint to enable
database optimizations.
|
void |
setTransactionIsolation(int level)
You can call this method to try to change the transaction
isolation level using one of the TRANSACTION_* values.
|
clearWarnings, createStatement, dispose, getAutoCommit, getCatalog, getMetaData, getTransactionIsolation, getWarnings, initialize, isClosed, isReadOnly, nativeSQL, prepareCall, prepareStatement
public IfsConnection(S_LibrarySession session) throws IfsException
session
- the serverside LibrarySessionIfsException
- if the operation failsprotected StatementWrapper constructStatementWrapper(Statement stmt)
This can be overridden to construct a subclass of StatementWrapper.
constructStatementWrapper
in class ConnectionWrapper
stmt
- the Statement to wrapprotected PreparedStatementWrapper constructPreparedStatementWrapper(PreparedStatement pstmt)
This can be overridden to construct a subclass of PreparedStatementWrapper.
constructPreparedStatementWrapper
in class ConnectionWrapper
pstmt
- the PreparedStatement to wrapprotected CallableStatementWrapper constructCallableStatementWrapper(CallableStatement cstmt)
This can be overridden to construct a subclass of CallableStatement.
constructCallableStatementWrapper
in class ConnectionWrapper
cstmt
- the CallableStatement to wrappublic ResultSet executeQuery(Statement stmt, String sql) throws SQLException
executeQuery
in class ConnectionWrapper
stmt
- the Statementsql
- typically this is a static SQL SELECT statementSQLException
- if a database-access error occurs.public int executeUpdate(Statement stmt, String sql) throws SQLException
executeUpdate
in class ConnectionWrapper
stmt
- the Statementsql
- a SQL INSERT, UPDATE or DELETE statement or a SQL
statement that returns nothingSQLException
- if a database-access error occurs.public boolean execute(Statement stmt, String sql) throws SQLException
execute
in class ConnectionWrapper
stmt
- any SQL statementsql
- the SQL stringSQLException
- if a database-access error occurs.public int[] executeBatch(Statement stmt) throws SQLException
executeBatch
in class ConnectionWrapper
stmt
- any SQL statementSQLException
- if a database-access error occurs.public ResultSet executeQuery(PreparedStatement pstmt) throws SQLException
executeQuery
in class ConnectionWrapper
pstmt
- the SQL statementSQLException
- if a database-access error occurs.public int executeUpdate(PreparedStatement pstmt) throws SQLException
executeUpdate
in class ConnectionWrapper
pstmt
- the SQL statementSQLException
- if a database-access error occurs.public boolean execute(PreparedStatement pstmt) throws SQLException
execute
in class ConnectionWrapper
pstmt
- the SQL statementSQLException
- if a database-access error occurs.public void setAutoCommit(boolean autoCommit) throws SQLException
setAutoCommit
in class ConnectionWrapper
autoCommit
- true enables auto-commit; false disables
auto-commit.SQLException
- if a database-access error occurs.public void commit() throws SQLException
commit
in class ConnectionWrapper
SQLException
- if a database-access error occurs.public void commit(boolean force) throws SQLException
SQLException
public void rollback() throws SQLException
rollback
in class ConnectionWrapper
SQLException
- if a database-access error occurs.public void rollback(boolean force) throws SQLException
SQLException
public void setReadOnly(boolean readOnly) throws SQLException
Note: setReadOnly cannot be called while in the middle of a transaction.
setReadOnly
in class ConnectionWrapper
readOnly
- true enables read-only mode; false disables
read-only mode.SQLException
- if a database-access error occurs.public void setCatalog(String catalog) throws SQLException
setCatalog
in class ConnectionWrapper
catalog
- tthe catalog nameSQLException
- if a database-access error occurs.public void setTransactionIsolation(int level) throws SQLException
Note: setTransactionIsolation cannot be called while in the middle of a transaction.
setTransactionIsolation
in class ConnectionWrapper
level
- one of the TRANSACTION_* isolation values with the
exception of TRANSACTION_NONE; some databases may not support
other valuesSQLException
- if a database-access error occurs.Copyright © 2023. All rights reserved.