| com.lutris.appserver.server.sql.DBConnection
DBConnection | public interface DBConnection (Code) | | This interface defines a database connection.
author: Paul Morgan since: LBS1.8 version: $Revision: 1.1 $ |
allocate | public void allocate() throws SQLException(Code) | | Method called when this connection object is allocated from the
connection allocator.
exception: SQLException - if reset had no been called on the previous operation. |
close | public void close()(Code) | | Close this connection. Use by the connection allocator when this
object is no longer used. Errors are ignored.
|
execute | public boolean execute(String sql) throws SQLException(Code) | | Execute a SQL statement that does not return a resultset. This is a
wrapper that adds logging. Once the query has completed,
reset() should be called.
Parameters: sql - The SQL query statement True if the next result is a ResultSet; false if it isan update count or there are no more results. exception: java.sql.SQLException - If a SQL error occured executing thestatement. |
executeQuery | public ResultSet executeQuery(PreparedStatement preparedStmt, String msg) throws SQLException(Code) | | Execute a prepared query statement. Once the query has completed,
reset() should be called.
Parameters: preparedStmt - The statement to execute. Parameters: msg - for logging/debug purposes Query result set, do not call close, use reset(), exception: java.sql.SQLException - If a SQL error occured executing thestatement. |
executeQuery | public ResultSet executeQuery(String sql) throws SQLException(Code) | | Execute a SQL query statement. This is a wrapper that adds logging.
Once the query has completed, reset() should be called.
Parameters: sql - The SQL query statement Query result set, do not call close, use reset(), exception: java.sql.SQLException - If a SQL error occured executing thestatement. |
executeUpdate | public int executeUpdate(String sql) throws SQLException(Code) | | Execute a SQL update statement. This is a wrapper that adds logging.
Once the update has completed, reset() should be called.
Parameters: sql - The SQL query statementEither the row count for UPDATE, INSERT, DELETE or 0 forSQL statements that return nothing. exception: java.sql.SQLException - If a SQL error occured executing the update. |
executeUpdate | public int executeUpdate(PreparedStatement preparedStmt, String msg) throws SQLException(Code) | | Execute a prepared update statement. Once the update has completed,
reset() should be called.
Parameters: preparedStmt - The statement to execute. Parameters: msg - for logging/debug purposes Either the row count for UPDATE, INSERT, DELETE or 0 forSQL statements that return nothing. exception: java.sql.SQLException - If a SQL error occured executing thestatement. |
getConnection | public Connection getConnection()(Code) | | Get the underlying Connection object.
Use with extreme caution.
the connection object |
getDatabaseName | public String getDatabaseName()(Code) | | database name of current connection |
getGeneration | public int getGeneration()(Code) | | Get the generation number specified when the connection was created.
The generation number. |
getUrl | public String getUrl()(Code) | | Get the database URL.
The database URL. |
getUser | public String getUser()(Code) | | Get the database user name. Normally user for error messages.
The database user name. |
handleException | public boolean handleException(SQLException sqlExcept)(Code) | | Check if a connection is valid after an SQL exception
is thrown. If it is not usable, then the connection is
dropped from the connection allocator and closed. The connection
is then no longer usable.
Parameters: sqlExcept - the SQL exception that occured. trueif the exception does not affect thisconnection object. False otherwise - in which casethis connection object is no longer usable. |
incrRequestCount | public void incrRequestCount()(Code) | | Increment the count of the number of requests against
this connection.
|
isMarkedForDrop | public boolean isMarkedForDrop()(Code) | | true if this connection is marked to be dropped outof the connection pool and closed. |
prepareCall | public CallableStatement prepareCall(String sql) throws SQLException(Code) | | Creates a CallableStatement object for calling database
stored procedures. Refer to jdk api refernece.
Parameters: sql - The SQL statement to be called. a new CallableStatement object containing the pre-compiled SQL statement. exception: java.sql.SQLException - If a database access error occursstatement. |
prepareStatement | public PreparedStatement prepareStatement(String sql) throws SQLException(Code) | | Get a prepared statement given an SQL string. If the statement is
cached, return that statement, otherwise prepare and save in the
cache.
Parameters: sql - The SQL statement to prepared. The prepared statement, which is associated only with thisconnection and must not be used once the connection is released. exception: java.sql.SQLException - If a SQL error occured compiling thestatement. |
release | public void release()(Code) | | Return this connection to its allocator. This object should not be
used after calling this function.
|
setAutoCommit | public void setAutoCommit(boolean on) throws SQLException(Code) | | Autocommit on/off.
Parameters: on - false to disable auto commit mode. True to enable. exception: SQLException - if a database access error occurs. |
validate | public void validate() throws SQLException(Code) | | Validates this connection. Check to see that it
is not closed and has been properly allocated.
exception: java.sql.SQLException - If it is not valid. |
warningCheck | public void warningCheck(ResultSet resultSet) throws SQLException(Code) | | Check for warnings in a result set.
Parameters: resultSet - The result set to check for warnings. exception: java.sql.SQLException - If a SQL error occured compiling thestatement. |
|
|