|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.uwyn.rife.database.DbQueryManager
public class DbQueryManager
This is a convenience class to make it easy to control the queries that
handle the retrieval, storage, update and removal of data in a database.
All queries will be executed in a connection of the Datasource
that's provided to the constructor of the DbQueryManager.
A collection of convenience methods have been provided to quickly
execute queries in a variety of manners without having to worry about the
logic behind it or having to remember to close the queries at the
appropriate moment. These methods optionally interact with the
DbPreparedStatementHandler and DbResultSetHandler
classes to make it possible to fully customize the executed queries. The
following categories of worry-free methods exist:
Lower-level methods are also available for the sake of repetitive
code-reduction. To obtain execute regular statements directly,
use the executeQuery method.
Finally, since DbStatement and
DbPreparedStatement instances preserve a reference to their
resultset, it's easy to iterate over the rows of a resultset with the
fetch or fetchAll methods.
DbPreparedStatement,
DbStatement,
DbRowProcessor,
DbPreparedStatementHandler,
DbResultSetHandler,
DbConnectionUser| Constructor Summary | |
|---|---|
DbQueryManager(Datasource datasource)
Instantiates a new DbQueryManager object and ties it to
the provided datasource. |
|
| Method Summary | ||
|---|---|---|
Object |
clone()
Simply clones the instance with the default clone method. |
|
boolean |
executeFetchAll(ReadQuery query,
DbRowProcessor rowProcessor)
Safely and quickly fetches all the rows from the results of a select query. |
|
boolean |
executeFetchAll(ReadQuery query,
DbRowProcessor rowProcessor,
DbPreparedStatementHandler handler)
Safely fetches all the rows from the results of a customizable select query. |
|
|
executeFetchAllBeans(ReadQuery query,
Class<BeanType> beanClass)
Safely and quickly fetches the all the bean instances from the results of a select query. |
|
|
executeFetchAllBeans(ReadQuery query,
Class<BeanType> beanClass,
DbPreparedStatementHandler handler)
Safely fetches the all the bean instances from the results of a customizable select query. |
|
boolean |
executeFetchFirst(ReadQuery query,
DbRowProcessor rowProcessor)
Safely and quickly fetches the first row from the results of a select query. |
|
boolean |
executeFetchFirst(ReadQuery query,
DbRowProcessor rowProcessor,
DbPreparedStatementHandler handler)
Safely fetches the first row from the results of a customizable select query. |
|
|
executeFetchFirstBean(ReadQuery query,
Class<BeanType> beanClass)
Safely and quickly fetches the first bean instance from the results of a select query. |
|
|
executeFetchFirstBean(ReadQuery query,
Class<BeanType> beanClass,
DbPreparedStatementHandler handler)
Safely fetches the first bean instance from the results of a customizable select query. |
|
boolean |
executeGetFirstBoolean(ReadQuery query)
Safely and quickly retrieves the first cell as a boolean
from the results of a select query. |
|
boolean |
executeGetFirstBoolean(ReadQuery query,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a boolean from the
results of a customizable select query. |
|
byte |
executeGetFirstByte(ReadQuery query)
Safely and quickly retrieves the first cell as a byte from
the results of a select query. |
|
byte |
executeGetFirstByte(ReadQuery query,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a byte from the results
of a customizable select query. |
|
byte[] |
executeGetFirstBytes(ReadQuery query)
Safely and quickly retrieves the first cell as a byte
array from the results of a select query. |
|
byte[] |
executeGetFirstBytes(ReadQuery query,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a byte array from the
results of a customizable select query. |
|
Date |
executeGetFirstDate(ReadQuery query)
Safely and quickly retrieves the first cell as a sql Date
from the results of a select query. |
|
Date |
executeGetFirstDate(ReadQuery query,
Calendar cal)
Safely and quickly retrieves the first cell as a sql Date
from the results of a select query. |
|
Date |
executeGetFirstDate(ReadQuery query,
Calendar cal,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a sql Date from the
results of a customizable select query. |
|
Date |
executeGetFirstDate(ReadQuery query,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a sql Date from the
results of a customizable select query. |
|
double |
executeGetFirstDouble(ReadQuery query)
Safely and quickly retrieves the first cell as a double
from the results of a select query. |
|
double |
executeGetFirstDouble(ReadQuery query,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a double from the
results of a customizable select query. |
|
float |
executeGetFirstFloat(ReadQuery query)
Safely and quickly retrieves the first cell as a float
from the results of a select query. |
|
float |
executeGetFirstFloat(ReadQuery query,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a float from the
results of a customizable select query. |
|
int |
executeGetFirstInt(ReadQuery query)
Safely and quickly retrieves the first cell as a int from
the results of a select query. |
|
int |
executeGetFirstInt(ReadQuery query,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a int from the results
of a customizable select query. |
|
long |
executeGetFirstLong(ReadQuery query)
Safely and quickly retrieves the first cell as a long from
the results of a select query. |
|
long |
executeGetFirstLong(ReadQuery query,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a long from the results
of a customizable select query. |
|
short |
executeGetFirstShort(ReadQuery query)
Safely and quickly retrieves the first cell as a short
from the results of a select query. |
|
short |
executeGetFirstShort(ReadQuery query,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a short from the
results of a customizable select query. |
|
String |
executeGetFirstString(ReadQuery query)
Safely and quickly retrieves the first cell as a String
from the results of a select query. |
|
String |
executeGetFirstString(ReadQuery query,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a String from the
results of a customizable select query. |
|
Time |
executeGetFirstTime(ReadQuery query)
Safely and quickly retrieves the first cell as a sql Time
from the results of a select query. |
|
Time |
executeGetFirstTime(ReadQuery query,
Calendar cal)
Safely and quickly retrieves the first cell as a sql Time
from the results of a select query. |
|
Time |
executeGetFirstTime(ReadQuery query,
Calendar cal,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a sql Time from the
results of a customizable select query. |
|
Time |
executeGetFirstTime(ReadQuery query,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a sql Time from the
results of a customizable select query. |
|
Timestamp |
executeGetFirstTimestamp(ReadQuery query)
Safely and quickly retrieves the first cell as a sql Timestamp from the results of a select query. |
|
Timestamp |
executeGetFirstTimestamp(ReadQuery query,
Calendar cal)
Safely and quickly retrieves the first cell as a sql Timestamp from the results of a select query. |
|
Timestamp |
executeGetFirstTimestamp(ReadQuery query,
Calendar cal,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a sql Timestamp from
the results of a customizable select query. |
|
Timestamp |
executeGetFirstTimestamp(ReadQuery query,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as a sql Timestamp from
the results of a customizable select query. |
|
boolean |
executeHasResultRows(ReadQuery query)
Safely and quickly verifies if a select query returns any rows. |
|
boolean |
executeHasResultRows(ReadQuery query,
DbPreparedStatementHandler handler)
Safely verifies if a customizable select query returns any rows. |
|
DbStatement |
executeQuery(ReadQuery query)
Executes a query statement in a connection of this DbQueryManager's Datasource. |
|
|
executeQuery(ReadQuery query,
DbPreparedStatementHandler handler)
Executes a customizable select statement. |
|
|
executeQuery(ReadQuery query,
DbResultSetHandler handler)
Executes a select statement and handle the results in a custom fashion. |
|
int |
executeUpdate(Query query)
Safely and quickly executes an update statement. |
|
int |
executeUpdate(Query query,
DbPreparedStatementHandler handler)
Safely execute an updates statement. |
|
int |
executeUpdate(String sql)
Safely and quickly executes an update statement. |
|
|
executeUseFirstAsciiStream(ReadQuery query,
InputStreamUser user)
Safely and quickly retrieves the first cell as an ASCII InputStream from the results of a select query. |
|
|
executeUseFirstAsciiStream(ReadQuery query,
InputStreamUser user,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as an ASCII InputStream
from the results of a customizable select query. |
|
|
executeUseFirstBinaryStream(ReadQuery query,
InputStreamUser user)
Safely and quickly retrieves the first cell as an binary InputStream from the results of a select query. |
|
|
executeUseFirstBinaryStream(ReadQuery query,
InputStreamUser user,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as an binary InputStream
from the results of a customizable select query. |
|
|
executeUseFirstCharacterStream(ReadQuery query,
ReaderUser user)
Safely and quickly retrieves the first cell as an character Reader from the results of a select query. |
|
|
executeUseFirstCharacterStream(ReadQuery query,
ReaderUser user,
DbPreparedStatementHandler handler)
Safely retrieves the first cell as an character Reader
from the results of a customizable select query. |
|
boolean |
fetch(ResultSet resultSet)
Fetches the next row of a resultset without processing it in any way. |
|
boolean |
fetch(ResultSet resultSet,
DbRowProcessor rowProcessor)
Fetches the next row of a resultset and processes it through a DbRowProcessor. |
|
boolean |
fetchAll(ResultSet resultSet,
DbRowProcessor rowProcessor)
Fetches all the next rows of a resultset and processes it through a DbRowProcessor. |
|
DbConnection |
getConnection()
Obtains a DbConnection of this DbQueryManager's
Datasource. |
|
Datasource |
getDatasource()
Retrieves the Datasource of this
DbQueryManager. |
|
|
inTransaction(DbTransactionUser user)
Ensures that all the instructions that are executed in the provided DbTransactionUser instance are executed inside a transaction
and committed afterwards. |
|
|
reserveConnection(DbConnectionUser user)
Reserves a database connection for a this particular thread for all the instructions that are executed in the provided DbConnectionUser
instance. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DbQueryManager(Datasource datasource)
DbQueryManager object and ties it to
the provided datasource.
datasource - the datasource that will be used to obtain database
connections from| Method Detail |
|---|
public int executeUpdate(String sql)
throws DatabaseException
DbStatement.executeUpdate(String) method, but also
automatically closes the statement after its execution.
This method is typically used in situations where one static update query needs to be executed without any parametrization or other processing.
DbQueryManager manager = new DbQueryManager(datasource);
int count = manager.executeUpdate("INSERT INTO person (name) VALUES ('me')");
sql - the sql query that has to be executed
DatabaseException - see DbStatement.executeUpdate(String)DbStatement.executeUpdate(String),
executeUpdate(Query)
public int executeUpdate(Query query)
throws DatabaseException
DbStatement.executeUpdate(Query) method, but also
automatically closes the statement after its execution.
This method is typically used in situations where one static update query needs to be executed without any parametrization or other processing.
DbQueryManager manager = new DbQueryManager(datasource);
Insert insert = new Insert(datasource);
insert.into("person").field("name", "me");
int count = manager.executeUpdate(insert);
query - the query builder instance that needs to be executed
DatabaseException - see DbStatement.executeUpdate(Query)DbStatement.executeUpdate(Query),
executeUpdate(String)
public int executeUpdate(Query query,
DbPreparedStatementHandler handler)
throws DatabaseException
DbPreparedStatement.executeUpdate() method, but also automatically
closes the statement after its execution and allows customization of
the prepared statement through an optional instance of DbPreparedStatementHandler.
This method is typically used when you need to fully customize a query at runtime, but still want to benefit of a safety net that ensures that the allocated statement will be closed.
DbQueryManager manager = new DbQueryManager(datasource);
Insert insert = new Insert(datasource);
insert.into("person").fieldParameter("name");
final String name = "me";
int count = manager.executeUpdate(insert, new DbPreparedStatementHandler() {
public void setParameters(DbPreparedStatement statement)
{
statement
.setString("name", name);
}
});
query - the query builder instance that needs to be executedhandler - an instance of DbPreparedStatementHandler
that will be used to customize the query execution; or
null if you don't want to customize it at all
DatabaseException - see DbPreparedStatement.executeUpdate()DbPreparedStatement.executeUpdate(),
DbPreparedStatementHandler
public boolean executeHasResultRows(ReadQuery query)
throws DatabaseException
DbResultSet.hasResultRows() method, but
also automatically closes the statement after its execution.
DbQueryManager manager = new DbQueryManager(datasource);
Select select = new Select(datasource);
select.from("person");
boolean result = manager.executeHasResultRows(select);
query - the query builder instance that needs to be executed
true when rows were returned by the query; or
false otherwise
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.hasResultRows()DbPreparedStatement.executeQuery(),
DbResultSet.hasResultRows(),
DbPreparedStatementHandler
public boolean executeHasResultRows(ReadQuery query,
DbPreparedStatementHandler handler)
throws DatabaseException
DbResultSet.hasResultRows() method, but
also automatically closes the statement after its execution and allows
customization of the prepared statement through an optional instance of
DbPreparedStatementHandler.
DbQueryManager manager = new DbQueryManager(datasource);
Select select = new Select(datasource);
select.from("person").whereParameter("name", "=");
final String name = "you";
boolean result = manager.executeHasResultRows(select, new DbPreparedStatementHandler() {
public void setParameters(DbPreparedStatement statement)
{
statement
.setString("name", name);
}
});
query - the query builder instance that needs to be executedhandler - an instance of DbPreparedStatementHandler
that will be used to customize the query execution; or
null if you don't want to customize it at all
true when rows were returned by the query; or
false otherwise
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.hasResultRows()DbPreparedStatement.executeQuery(),
DbResultSet.hasResultRows(),
DbPreparedStatementHandler
public String executeGetFirstString(ReadQuery query)
throws DatabaseException
String
from the results of a select query. It relies on the wrapped DbResultSet.getFirstString() method, but also automatically closes the
statement after its execution.
DbQueryManager manager = new DbQueryManager(datasource);
Select select = new Select(datasource);
select.field("name").from("person");
String result = manager.executeGetFirstString(select);
query - the query builder instance that needs to be executed
String in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstString()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstString(),
DbPreparedStatementHandler
public String executeGetFirstString(ReadQuery query,
DbPreparedStatementHandler handler)
throws DatabaseException
String from the
results of a customizable select query. It relies on the wrapped DbResultSet.getFirstString() method, but also automatically closes the
statement after its execution and allows customization of the prepared
statement through an optional instance of DbPreparedStatementHandler.
DbQueryManager manager = new DbQueryManager(datasource);
Select select = new Select(datasource);
select.field("first").from("person").whereParameter("last", "=");
final String last = "Smith";
String result = manager.executeGetFirstString(select, new DbPreparedStatementHandler() {
public void setParameters(DbPreparedStatement statement)
{
statement
.setString("last", last);
}
});
query - the query builder instance that needs to be executedhandler - an instance of DbPreparedStatementHandler
that will be used to customize the query execution; or
null if you don't want to customize it at all
String in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstString()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstString(),
DbPreparedStatementHandler
public boolean executeGetFirstBoolean(ReadQuery query)
throws DatabaseException
boolean
from the results of a select query. It relies on the wrapped DbResultSet.getFirstBoolean() method, but also automatically closes
the statement after its execution.
Refer to executeGetFirstString
for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executed
boolean in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstBoolean()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstBoolean(),
DbPreparedStatementHandler
public boolean executeGetFirstBoolean(ReadQuery query,
DbPreparedStatementHandler handler)
throws DatabaseException
boolean from the
results of a customizable select query. It relies on the wrapped DbResultSet.getFirstBoolean() method, but also automatically closes
the statement after its execution and allows customization of the
prepared statement through an optional instance of DbPreparedStatementHandler.
Refer to executeGetFirstString for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executedhandler - an instance of DbPreparedStatementHandler
that will be used to customize the query execution; or
null if you don't want to customize it at all
boolean in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstBoolean()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstBoolean(),
DbPreparedStatementHandler
public byte executeGetFirstByte(ReadQuery query)
throws DatabaseException
byte from
the results of a select query. It relies on the wrapped DbResultSet.getFirstByte() method, but also automatically closes the
statement after its execution.
Refer to executeGetFirstString
for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executed
byte in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstByte()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstByte(),
DbPreparedStatementHandler
public byte executeGetFirstByte(ReadQuery query,
DbPreparedStatementHandler handler)
throws DatabaseException
byte from the results
of a customizable select query. It relies on the wrapped DbResultSet.getFirstByte() method, but also automatically closes the
statement after its execution and allows customization of the prepared
statement through an optional instance of DbPreparedStatementHandler.
Refer to executeGetFirstString for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executedhandler - an instance of DbPreparedStatementHandler
that will be used to customize the query execution; or
null if you don't want to customize it at all
byte in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstByte()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstByte(),
DbPreparedStatementHandler
public short executeGetFirstShort(ReadQuery query)
throws DatabaseException
short
from the results of a select query. It relies on the wrapped DbResultSet.getFirstShort() method, but also automatically closes the
statement after its execution.
Refer to executeGetFirstString
for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executed
short in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstShort()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstShort(),
DbPreparedStatementHandler
public short executeGetFirstShort(ReadQuery query,
DbPreparedStatementHandler handler)
throws DatabaseException
short from the
results of a customizable select query. It relies on the wrapped DbResultSet.getFirstShort() method, but also automatically closes the
statement after its execution and allows customization of the prepared
statement through an optional instance of DbPreparedStatementHandler.
Refer to executeGetFirstString for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executedhandler - an instance of DbPreparedStatementHandler
that will be used to customize the query execution; or
null if you don't want to customize it at all
short in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstShort()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstShort(),
DbPreparedStatementHandler
public int executeGetFirstInt(ReadQuery query)
throws DatabaseException
int from
the results of a select query. It relies on the wrapped DbResultSet.getFirstInt() method, but also automatically closes the
statement after its execution.
Refer to executeGetFirstString
for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executed
int in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstInt()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstInt(),
DbPreparedStatementHandler
public int executeGetFirstInt(ReadQuery query,
DbPreparedStatementHandler handler)
throws DatabaseException
int from the results
of a customizable select query. It relies on the wrapped DbResultSet.getFirstInt() method, but also automatically closes the
statement after its execution and allows customization of the prepared
statement through an optional instance of DbPreparedStatementHandler.
Refer to executeGetFirstString for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executedhandler - an instance of DbPreparedStatementHandler
that will be used to customize the query execution; or
null if you don't want to customize it at all
int in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstInt()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstInt(),
DbPreparedStatementHandler
public long executeGetFirstLong(ReadQuery query)
throws DatabaseException
long from
the results of a select query. It relies on the wrapped DbResultSet.getFirstLong() method, but also automatically closes the
statement after its execution.
Refer to executeGetFirstString
for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executed
long in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstLong()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstLong(),
DbPreparedStatementHandler
public long executeGetFirstLong(ReadQuery query,
DbPreparedStatementHandler handler)
throws DatabaseException
long from the results
of a customizable select query. It relies on the wrapped DbResultSet.getFirstLong() method, but also automatically closes the
statement after its execution and allows customization of the prepared
statement through an optional instance of DbPreparedStatementHandler.
Refer to executeGetFirstString for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executedhandler - an instance of DbPreparedStatementHandler
that will be used to customize the query execution; or
null if you don't want to customize it at all
long in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstLong()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstLong(),
DbPreparedStatementHandler
public float executeGetFirstFloat(ReadQuery query)
throws DatabaseException
float
from the results of a select query. It relies on the wrapped DbResultSet.getFirstFloat() method, but also automatically closes the
statement after its execution.
Refer to executeGetFirstString
for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executed
float in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstFloat()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstFloat(),
DbPreparedStatementHandler
public float executeGetFirstFloat(ReadQuery query,
DbPreparedStatementHandler handler)
throws DatabaseException
float from the
results of a customizable select query. It relies on the wrapped DbResultSet.getFirstFloat() method, but also automatically closes the
statement after its execution and allows customization of the prepared
statement through an optional instance of DbPreparedStatementHandler.
Refer to executeGetFirstString for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executedhandler - an instance of DbPreparedStatementHandler
that will be used to customize the query execution; or
null if you don't want to customize it at all
float in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstFloat()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstFloat(),
DbPreparedStatementHandler
public double executeGetFirstDouble(ReadQuery query)
throws DatabaseException
double
from the results of a select query. It relies on the wrapped DbResultSet.getFirstDouble() method, but also automatically closes the
statement after its execution.
Refer to executeGetFirstString
for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executed
double in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstDouble()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstDouble(),
DbPreparedStatementHandler
public double executeGetFirstDouble(ReadQuery query,
DbPreparedStatementHandler handler)
throws DatabaseException
double from the
results of a customizable select query. It relies on the wrapped DbResultSet.getFirstDouble() method, but also automatically closes the
statement after its execution and allows customization of the prepared
statement through an optional instance of DbPreparedStatementHandler.
Refer to executeGetFirstString for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executedhandler - an instance of DbPreparedStatementHandler
that will be used to customize the query execution; or
null if you don't want to customize it at all
double in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstDouble()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstDouble(),
DbPreparedStatementHandler
public byte[] executeGetFirstBytes(ReadQuery query)
throws DatabaseException
byte
array from the results of a select query. It relies on the wrapped
DbResultSet.getFirstBytes() method, but also automatically
closes the statement after its execution.
Refer to executeGetFirstString
for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executed
byte array in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstBytes()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstBytes(),
DbPreparedStatementHandler
public byte[] executeGetFirstBytes(ReadQuery query,
DbPreparedStatementHandler handler)
throws DatabaseException
byte array from the
results of a customizable select query. It relies on the wrapped DbResultSet.getFirstBytes() method, but also automatically closes the
statement after its execution and allows customization of the prepared
statement through an optional instance of DbPreparedStatementHandler.
Refer to executeGetFirstString for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executedhandler - an instance of DbPreparedStatementHandler
that will be used to customize the query execution; or
null if you don't want to customize it at all
byte array in the query's resultset
DatabaseException - see DbPreparedStatement.executeQuery()and DbResultSet.getFirstBytes()DbPreparedStatement.executeQuery(),
DbResultSet.getFirstBytes(),
DbPreparedStatementHandler
public Date executeGetFirstDate(ReadQuery query)
throws DatabaseException
Date
from the results of a select query. It relies on the wrapped DbResultSet.getFirstDate() method, but also automatically closes the
statement after its execution.
Refer to executeGetFirstString
for an example code snippet, it's 100% analogue.
query - the query builder instance that needs to be executed
Date in the query's resultset
DatabaseException