public class DefaultStatementHolder extends Object implements StatementHolder
| Constructor and Description |
|---|
DefaultStatementHolder(Connection connection) |
DefaultStatementHolder(Connection connection,
boolean pooled) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying Statement and Connection if this StatementHolder is
not pooled.
|
int |
executeUpdate(String sql)
Executes the given SQL statement.
|
int |
executeUpdate(String sql,
boolean ignoreException)
Executes the given SQL statement.
|
void |
forceClose()
Closes the underlying Statement and Connection disregarding whether this
StatementHolder is not pooled or not.
|
Connection |
getConnection()
Returns the wrapped Connection.
|
Statement |
getStatement()
Returns the wrapped Statement.
|
boolean |
isPooled()
Method indicating whether the wrapped Connection is pooled.
|
Double |
queryForDouble(String sql)
Executes the given SQL statement and returns the first column of the first
row in the resulting ResultSet as a Double.
|
Integer |
queryForInteger(String sql)
Executes the given SQL statement and returns the first column of the first
row in the resulting ResultSet as an Integer.
|
String |
queryForString(String sql)
Executes the given SQL statement and returns the first column of the first
row in the resulting ResultSet as a String.
|
int |
update(String sql)
Executes a INSERT, UPDATE or DELETE SQL statement or an SQL statement that
returns nothing.
|
public DefaultStatementHolder(Connection connection)
public DefaultStatementHolder(Connection connection, boolean pooled)
public Statement getStatement()
StatementHoldergetStatement in interface StatementHolderpublic Connection getConnection()
StatementHoldergetConnection in interface StatementHolderpublic boolean isPooled()
StatementHolderisPooled in interface StatementHolderpublic int executeUpdate(String sql)
StatementHolderexecuteUpdate in interface StatementHoldersql - the SQL statement.public int executeUpdate(String sql, boolean ignoreException)
StatementHolderexecuteUpdate in interface StatementHoldersql - the SQL statement.ignoreException - indicates whether to skip closing the underlying
connection if an exception occurs.public Integer queryForInteger(String sql)
StatementHolderqueryForInteger in interface StatementHoldersql - the SQL statementpublic Double queryForDouble(String sql)
StatementHolderqueryForDouble in interface StatementHoldersql - the SQL statementpublic String queryForString(String sql)
StatementHolderqueryForString in interface StatementHoldersql - the SQL statementpublic int update(String sql)
StatementHolderupdate in interface StatementHoldersql - the SQL statement to execute.public void close()
StatementHolderclose in interface StatementHolderpublic void forceClose()
StatementHolderforceClose in interface StatementHolderCopyright © 2016 UiO. All rights reserved.