|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DatabaseConnection
Specifies a database connection, providing basic transaction control and helper functions for querying and manipulating data.
Nested Class Summary | |
---|---|
static interface |
DatabaseConnection.Function
A database function |
static interface |
DatabaseConnection.Operation
A database operation |
static interface |
DatabaseConnection.Procedure
A database procedure |
Method Summary | |
---|---|
void |
execute(List<String> statements)
Executes the given statements, in a batch if possible, which can be anything except a select query. |
void |
execute(String sql)
Executes the given statement, which can be anything except a select query. |
Object |
executeCallableStatement(String sqlStatement,
int outParameterType)
Executes the statement. |
List<?> |
executeFunction(String functionID,
Object... arguments)
Executes the function with the given id |
void |
executeProcedure(String procedureID,
Object... arguments)
Executes the procedure with the given id |
boolean |
isConnected()
|
List |
query(String sql,
ResultPacker resultPacker,
int fetchCount)
Performs the given sql query and returns the result in a List |
int |
queryInteger(String sql)
Performs the given query and returns the result as an integer |
List<Integer> |
queryIntegers(String sql)
Performs the given query and returns the result as a List of Integers |
List<List> |
queryObjects(String sql,
int fetchCount)
|
List<String> |
queryStrings(String sql)
Performs the given query and returns the result as a List of Strings |
byte[] |
readBlobField(String tableName,
String columnName,
String whereClause)
Returns the contents of the given blob field. |
void |
writeBlobField(byte[] blobData,
String tableName,
String columnName,
String whereClause)
Writes the given blob data into the given column. |
Methods inherited from interface org.jminor.common.db.PoolableConnection |
---|
beginTransaction, commit, commitTransaction, disconnect, getConnection, getDatabase, getLogEntries, getMethodLogger, getPoolTime, getRetryCount, getUser, isLoggingEnabled, isTransactionOpen, isValid, rollback, rollbackTransaction, setLoggingEnabled, setPoolTime, setRetryCount |
Method Detail |
---|
List query(String sql, ResultPacker resultPacker, int fetchCount) throws SQLException
sql
- the queryresultPacker
- a ResultPacker instance for creating the return ListfetchCount
- the number of records to retrieve, use -1 to retrieve all
SQLException
- thrown if anything goes wrong during the query executionboolean isConnected()
List<List> queryObjects(String sql, int fetchCount) throws SQLException
sql
- the queryfetchCount
- the maximum number of records to return, -1 for all
SQLException
- thrown if anything goes wrong during the query executionint queryInteger(String sql) throws SQLException, DatabaseException
sql
- the query must select at least a single number column, any other
subsequent columns are disregarded
SQLException
- thrown if anything goes wrong during the execution
DatabaseException
- thrown if no record is foundList<Integer> queryIntegers(String sql) throws SQLException
sql
- the query, it must select at least a single number column, any other
subsequent columns are disregarded
SQLException
- thrown if anything goes wrong during the executionList<String> queryStrings(String sql) throws SQLException
sql
- the query, it must select at least a single string column, any other
subsequent columns are disregarded
SQLException
- thrown if anything goes wrong during the executionbyte[] readBlobField(String tableName, String columnName, String whereClause) throws SQLException
tableName
- the table namecolumnName
- the name of the blob columnwhereClause
- the where clause
SQLException
- thrown if anything goes wrong during the executionvoid writeBlobField(byte[] blobData, String tableName, String columnName, String whereClause) throws SQLException
blobData
- the blob datatableName
- the table namecolumnName
- the blob column namewhereClause
- the where clause
SQLException
- thrown if anything goes wrong during the executionvoid execute(String sql) throws SQLException
sql
- the statement to execute
SQLException
- thrown if anything goes wrong during executionObject executeCallableStatement(String sqlStatement, int outParameterType) throws SQLException
sqlStatement
- the statement to executeoutParameterType
- the type of the out parameter, -1 if no out parameter, java.sql.Types.*
SQLException
- thrown if anything goes wrong during executionvoid execute(List<String> statements) throws SQLException
statements
- the statements to execute
SQLException
- thrown if anything goes wrong during executionList<?> executeFunction(String functionID, Object... arguments) throws DatabaseException
functionID
- the function IDarguments
- the arguments, if any
DatabaseException
- in case anyhing goes wrong during the executionvoid executeProcedure(String procedureID, Object... arguments) throws DatabaseException
procedureID
- the procedure IDarguments
- the arguments, if any
DatabaseException
- in case anyhing goes wrong during the execution
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |