Java Doc for DbQueryManager.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » database » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » rife 1.6.1 » com.uwyn.rife.database 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.uwyn.rife.database.DbQueryManager

All known Subclasses:   com.uwyn.rife.scheduler.taskoptionmanagers.DatabaseTaskoptions,  com.uwyn.rife.authentication.sessionvalidators.DatabaseSessionValidator,  com.uwyn.rife.resources.DatabaseResources,  com.uwyn.rife.scheduler.taskmanagers.DatabaseTasks,  com.uwyn.rife.cmf.dam.contentstores.DatabaseContentStore,  com.uwyn.rife.authentication.credentialsmanagers.DatabaseUsers,  database.Basic,  com.uwyn.rife.database.querymanagers.generic.AbstractGenericQueryManager,  com.uwyn.rife.authentication.sessionmanagers.DatabaseSessions,  com.uwyn.rife.authentication.remembermanagers.DatabaseRemember,  com.uwyn.rife.cmf.dam.contentstores.DatabaseRawStore,  tutorial.friends.backend.FriendManager,  com.uwyn.rife.database.TestDbQueryManagerImpl,  com.uwyn.rife.mail.dam.DatabaseMailQueue,  com.uwyn.rife.cmf.dam.contentmanagers.DatabaseContent,  com.uwyn.rife.scheduler.schedulermanagers.DatabaseScheduler,
DbQueryManager
public class DbQueryManager implements Cloneable(Code)
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 DbQueryManager.executeQuery(ReadQuery) 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 DbQueryManager.fetch(ResultSet,DbRowProcessor) fetch or DbQueryManager.fetchAll(ResultSet,DbRowProcessor) fetchAll methods.
author:
   Geert Bevin (gbevin[remove] at uwyn dot com)
version:
   $Revision: 3784 $
See Also:   com.uwyn.rife.database.DbPreparedStatement
See Also:   com.uwyn.rife.database.DbStatement
See Also:   com.uwyn.rife.database.DbRowProcessor
See Also:   com.uwyn.rife.database.DbPreparedStatementHandler
See Also:   com.uwyn.rife.database.DbResultSetHandler
See Also:   com.uwyn.rife.database.DbConnectionUser
since:
   1.0




Constructor Summary
public  DbQueryManager(Datasource datasource)
     Instantiates a new DbQueryManager object and ties it to the provided datasource.

Method Summary
public  Objectclone()
     Simply clones the instance with the default clone method.
public  booleanexecuteFetchAll(ReadQuery query, DbRowProcessor rowProcessor)
     Safely and quickly fetches all the rows from the results of a select query.
public  booleanexecuteFetchAll(ReadQuery query, DbRowProcessor rowProcessor, DbPreparedStatementHandler handler)
     Safely fetches all the rows from the results of a customizable select query.
public  List<BeanType>executeFetchAllBeans(ReadQuery query, Class<BeanType> beanClass)
     Safely and quickly fetches the all the bean instances from the results of a select query.
public  List<BeanType>executeFetchAllBeans(ReadQuery query, Class<BeanType> beanClass, DbPreparedStatementHandler handler)
     Safely fetches the all the bean instances from the results of a customizable select query.
public  booleanexecuteFetchFirst(ReadQuery query, DbRowProcessor rowProcessor)
     Safely and quickly fetches the first row from the results of a select query.
public  booleanexecuteFetchFirst(ReadQuery query, DbRowProcessor rowProcessor, DbPreparedStatementHandler handler)
     Safely fetches the first row from the results of a customizable select query.
public  BeanTypeexecuteFetchFirstBean(ReadQuery query, Class<BeanType> beanClass)
     Safely and quickly fetches the first bean instance from the results of a select query.
public  BeanTypeexecuteFetchFirstBean(ReadQuery query, Class<BeanType> beanClass, DbPreparedStatementHandler handler)
     Safely fetches the first bean instance from the results of a customizable select query.
public  booleanexecuteGetFirstBoolean(ReadQuery query)
     Safely and quickly retrieves the first cell as a boolean from the results of a select query.
public  booleanexecuteGetFirstBoolean(ReadQuery query, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a boolean from the results of a customizable select query.
public  byteexecuteGetFirstByte(ReadQuery query)
     Safely and quickly retrieves the first cell as a byte from the results of a select query.
public  byteexecuteGetFirstByte(ReadQuery query, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a byte from the results of a customizable select query.
public  byte[]executeGetFirstBytes(ReadQuery query)
     Safely and quickly retrieves the first cell as a byte array from the results of a select query.
public  byte[]executeGetFirstBytes(ReadQuery query, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a byte array from the results of a customizable select query.
public  java.sql.DateexecuteGetFirstDate(ReadQuery query)
     Safely and quickly retrieves the first cell as a sql Date from the results of a select query.
public  java.sql.DateexecuteGetFirstDate(ReadQuery query, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a sql Date from the results of a customizable select query.
public  java.sql.DateexecuteGetFirstDate(ReadQuery query, Calendar cal)
     Safely and quickly retrieves the first cell as a sql Date from the results of a select query.
public  java.sql.DateexecuteGetFirstDate(ReadQuery query, Calendar cal, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a sql Date from the results of a customizable select query.
public  doubleexecuteGetFirstDouble(ReadQuery query)
     Safely and quickly retrieves the first cell as a double from the results of a select query.
public  doubleexecuteGetFirstDouble(ReadQuery query, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a double from the results of a customizable select query.
public  floatexecuteGetFirstFloat(ReadQuery query)
     Safely and quickly retrieves the first cell as a float from the results of a select query.
public  floatexecuteGetFirstFloat(ReadQuery query, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a float from the results of a customizable select query.
public  intexecuteGetFirstInt(ReadQuery query)
     Safely and quickly retrieves the first cell as a int from the results of a select query.
public  intexecuteGetFirstInt(ReadQuery query, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a int from the results of a customizable select query.
public  longexecuteGetFirstLong(ReadQuery query)
     Safely and quickly retrieves the first cell as a long from the results of a select query.
public  longexecuteGetFirstLong(ReadQuery query, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a long from the results of a customizable select query.
public  shortexecuteGetFirstShort(ReadQuery query)
     Safely and quickly retrieves the first cell as a short from the results of a select query.
public  shortexecuteGetFirstShort(ReadQuery query, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a short from the results of a customizable select query.
public  StringexecuteGetFirstString(ReadQuery query)
     Safely and quickly retrieves the first cell as a String from the results of a select query.
public  StringexecuteGetFirstString(ReadQuery query, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a String from the results of a customizable select query.
public  java.sql.TimeexecuteGetFirstTime(ReadQuery query)
     Safely and quickly retrieves the first cell as a sql Time from the results of a select query.
public  java.sql.TimeexecuteGetFirstTime(ReadQuery query, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a sql Time from the results of a customizable select query.
public  java.sql.TimeexecuteGetFirstTime(ReadQuery query, Calendar cal)
     Safely and quickly retrieves the first cell as a sql Time from the results of a select query.
public  java.sql.TimeexecuteGetFirstTime(ReadQuery query, Calendar cal, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a sql Time from the results of a customizable select query.
public  java.sql.TimestampexecuteGetFirstTimestamp(ReadQuery query)
     Safely and quickly retrieves the first cell as a sql Timestamp from the results of a select query.
public  java.sql.TimestampexecuteGetFirstTimestamp(ReadQuery query, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a sql Timestamp from the results of a customizable select query.
public  java.sql.TimestampexecuteGetFirstTimestamp(ReadQuery query, Calendar cal)
     Safely and quickly retrieves the first cell as a sql Timestamp from the results of a select query.
public  java.sql.TimestampexecuteGetFirstTimestamp(ReadQuery query, Calendar cal, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as a sql Timestamp from the results of a customizable select query.
public  booleanexecuteHasResultRows(ReadQuery query)
     Safely and quickly verifies if a select query returns any rows.
public  booleanexecuteHasResultRows(ReadQuery query, DbPreparedStatementHandler handler)
     Safely verifies if a customizable select query returns any rows.
public  ResultTypeexecuteQuery(ReadQuery query, DbPreparedStatementHandler handler)
     Executes a customizable select statement.
public  ResultTypeexecuteQuery(ReadQuery query, DbResultSetHandler handler)
     Executes a select statement and handle the results in a custom fashion. It relies on the wrapped DbPreparedStatement.executeQuery method, but also automatically closes the statement after its execution and allows interaction with the resultset through an optional instance of DbResultSetHandler .

This method is typically used when you need to interact with the results of a query, but still want to benefit of a safety net that ensures that the allocated statement will be closed.

public  DbStatementexecuteQuery(ReadQuery query)
     Executes a query statement in a connection of this DbQueryManager's Datasource.
public  intexecuteUpdate(String sql)
     Safely and quickly executes an update statement.
public  intexecuteUpdate(Query query)
     Safely and quickly executes an update statement.
public  intexecuteUpdate(Query query, DbPreparedStatementHandler handler)
     Safely execute an updates statement.
public  ResultTypeexecuteUseFirstAsciiStream(ReadQuery query, InputStreamUser user)
     Safely and quickly retrieves the first cell as an ASCII InputStream from the results of a select query.
public  ResultTypeexecuteUseFirstAsciiStream(ReadQuery query, InputStreamUser user, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as an ASCII InputStream from the results of a customizable select query.
public  ResultTypeexecuteUseFirstBinaryStream(ReadQuery query, InputStreamUser user)
     Safely and quickly retrieves the first cell as an binary InputStream from the results of a select query.
public  ResultTypeexecuteUseFirstBinaryStream(ReadQuery query, InputStreamUser user, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as an binary InputStream from the results of a customizable select query.
public  ResultTypeexecuteUseFirstCharacterStream(ReadQuery query, ReaderUser user)
     Safely and quickly retrieves the first cell as an character Reader from the results of a select query.
public  ResultTypeexecuteUseFirstCharacterStream(ReadQuery query, ReaderUser user, DbPreparedStatementHandler handler)
     Safely retrieves the first cell as an character Reader from the results of a customizable select query.
public  booleanfetch(ResultSet resultSet)
     Fetches the next row of a resultset without processing it in any way.
public  booleanfetch(ResultSet resultSet, DbRowProcessor rowProcessor)
     Fetches the next row of a resultset and processes it through a DbRowProcessor.
public  booleanfetchAll(ResultSet resultSet, DbRowProcessor rowProcessor)
     Fetches all the next rows of a resultset and processes it through a DbRowProcessor.
public  DbConnectiongetConnection()
     Obtains a DbConnection of this DbQueryManager's Datasource.
public  DatasourcegetDatasource()
     Retrieves the Datasource of this DbQueryManager.
public  ResultTypeinTransaction(DbTransactionUser user)
     Ensures that all the instructions that are executed in the provided DbTransactionUser instance are executed inside a transaction and committed afterwards.
public  ResultTypereserveConnection(DbConnectionUser user)
     Reserves a database connection for a this particular thread for all the instructions that are executed in the provided DbConnectionUser instance.


Constructor Detail
DbQueryManager
public DbQueryManager(Datasource datasource)(Code)
Instantiates a new DbQueryManager object and ties it to the provided datasource.
Parameters:
  datasource - the datasource that will be used to obtain databaseconnections from
since:
   1.0




Method Detail
clone
public Object clone()(Code)
Simply clones the instance with the default clone method. This creates a shallow copy of all fields and the clone will in fact just be another reference to the same underlying data. The independence of each cloned instance is consciously not respected since they rely on resources that can't be cloned.
since:
   1.0 a clone of this instance



executeFetchAll
public boolean executeFetchAll(ReadQuery query, DbRowProcessor rowProcessor) throws DatabaseException(Code)
Safely and quickly fetches all the rows from the results of a select query. It relies on the wrapped DbQueryManager.fetchAll(ResultSet,DbRowProcessor) method, but automatically closes the statement after its execution.

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Select select = new Select(datasource);
 select.from("person").where("gender", "=", "m");
 DbRowProcessor processor = new YourProcessor();
 boolean result = manager.executeFetchAll(select, processor);

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  rowProcessor - a DbRowProcessor instance, if it'snull no processing will be performed on the fetched rows true if rows were retrieved; or

false if there are no more rows .
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbQueryManager.fetchAll(ResultSet,DbRowProcessor)
See Also:   DbQueryManager.fetchAll(ResultSet,DbRowProcessor)
See Also:   DbRowProcessor
since:
   1.0




executeFetchAll
public boolean executeFetchAll(ReadQuery query, DbRowProcessor rowProcessor, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely fetches all the rows from the results of a customizable select query. It relies on the wrapped DbQueryManager.fetchAll(ResultSet,DbRowProcessor) method, but also automatically closes the statement after its execution and allows customization of the prepared statement through an optional instance of DbPreparedStatementHandler .

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Select select = new Select(datasource);
 select.from("person").whereParameter("gender", "=");
 DbRowProcessor processor = new YourProcessor();
 final String name = "m";
 boolean result = manager.executeFetchAll(select, processor, new DbPreparedStatementHandler() {
 public void setParameters(DbPreparedStatement statement)
 {
 statement
 .setString("gender", name);
 }
 });

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  rowProcessor - a DbRowProcessor instance, if it'snull no processing will be performed on the fetched row
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all true if rows were retrieved; or

false if there are no more rows .
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbQueryManager.fetchAll(ResultSet,DbRowProcessor)
See Also:   DbQueryManager.fetchAll(ResultSet,DbRowProcessor)
See Also:   DbRowProcessor
since:
   1.0




executeFetchAllBeans
public List<BeanType> executeFetchAllBeans(ReadQuery query, Class<BeanType> beanClass) throws DatabaseException(Code)
Safely and quickly fetches the all the bean instances from the results of a select query. It relies on the wrapped DbQueryManager.executeFetchAll(ReadQuery,DbRowProcessor) method, but automatically uses an appropriate DbBeanFetcher instance and returns the results.

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Select select = new Select(datasource);
 select.from("person").fields(Person.class).where("gender", "=", "m");
 List persons = manager.executeFetchAllBeans(select, Person.class);

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  beanClass - the class of the bean a List instance with all the beans, the list is empty ifno beans could be returned
exception:
  DatabaseException - see DbBeanFetcher and DbQueryManager.executeFetchAll(ReadQuery,DbRowProcessor)
See Also:   DbQueryManager.executeFetchAll(ReadQuery,DbRowProcessor)
See Also:   DbBeanFetcher
since:
   1.0



executeFetchAllBeans
public List<BeanType> executeFetchAllBeans(ReadQuery query, Class<BeanType> beanClass, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely fetches the all the bean instances from the results of a customizable select query. It relies on the wrapped DbQueryManager.executeFetchAll(ReadQuery,DbRowProcessor) method, but automatically uses an appropriate DbBeanFetcher instance, returns the results and allows customization of the prepared statement through an optional instance of DbPreparedStatementHandler .

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Select select = new Select(datasource);
 select.from("person").fields(Person.class).whereParameter("gender", "=");
 final String name = "m";
 List persons = manager.executeFetchAllBeans(select, Person.class, new DbPreparedStatementHandler() {
 public void setParameters(DbPreparedStatement statement)
 {
 statement
 .setString("gender", name);
 }
 });

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  beanClass - the class of the bean
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all a List instance with all the beans, the list is empty ifno beans could be returned
exception:
  DatabaseException - see DbBeanFetcher and DbQueryManager.executeFetchAll(ReadQuery,DbRowProcessor)
See Also:   DbQueryManager.executeFetchAll(ReadQuery,DbRowProcessor)
See Also:   DbBeanFetcher
since:
   1.0



executeFetchFirst
public boolean executeFetchFirst(ReadQuery query, DbRowProcessor rowProcessor) throws DatabaseException(Code)
Safely and quickly fetches the first row from the results of a select query. It relies on the wrapped DbQueryManager.fetch(ResultSet,DbRowProcessor) method, but automatically closes the statement after its execution.

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Select select = new Select(datasource);
 select.from("person").where("name", "=", "me");
 DbRowProcessor processor = new YourProcessor();
 boolean result = manager.executeFetchFirst(select, processor);

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  rowProcessor - a DbRowProcessor instance, if it'snull no processing will be performed on the fetched row true if a row was retrieved; or

false if there are no more rows .
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbQueryManager.fetch(ResultSet,DbRowProcessor)
See Also:   DbQueryManager.fetch(ResultSet,DbRowProcessor)
See Also:   DbRowProcessor
since:
   1.0




executeFetchFirst
public boolean executeFetchFirst(ReadQuery query, DbRowProcessor rowProcessor, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely fetches the first row from the results of a customizable select query. It relies on the wrapped DbQueryManager.fetch(ResultSet,DbRowProcessor) method, but also automatically closes the statement after its execution and allows customization of the prepared statement through an optional instance of DbPreparedStatementHandler .

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Select select = new Select(datasource);
 select.from("person").whereParameter("name", "=");
 DbRowProcessor processor = new YourProcessor();
 final String name = "you";
 boolean result = manager.executeFetchFirst(select, processor, new DbPreparedStatementHandler() {
 public void setParameters(DbPreparedStatement statement)
 {
 statement
 .setString("name", name);
 }
 });

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  rowProcessor - a DbRowProcessor instance, if it'snull no processing will be performed on the fetched row
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all true if a row was retrieved; or

false if there are no more rows .
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbQueryManager.fetch(ResultSet,DbRowProcessor)
See Also:   DbQueryManager.fetch(ResultSet,DbRowProcessor)
See Also:   DbRowProcessor
since:
   1.0




executeFetchFirstBean
public BeanType executeFetchFirstBean(ReadQuery query, Class<BeanType> beanClass) throws DatabaseException(Code)
Safely and quickly fetches the first bean instance from the results of a select query. It relies on the wrapped DbQueryManager.executeFetchFirst(ReadQuery,DbRowProcessor) method, but automatically uses an appropriate DbBeanFetcher instance and returns the resulting bean.

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Select select = new Select(datasource);
 select.from("person").fields(Person.class);
 Person person = manager.executeFetchFirstBean(select, Person.class);

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  beanClass - the class of the bean true if a row was retrieved; or

false if there are no more rows .
exception:
  DatabaseException - see DbBeanFetcher and DbQueryManager.executeFetchFirst(ReadQuery,DbRowProcessor)
See Also:   DbQueryManager.executeFetchFirst(ReadQuery,DbRowProcessor)
See Also:   DbBeanFetcher
since:
   1.0




executeFetchFirstBean
public BeanType executeFetchFirstBean(ReadQuery query, Class<BeanType> beanClass, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely fetches the first bean instance from the results of a customizable select query. It relies on the wrapped DbQueryManager.executeFetchFirst(ReadQuery,DbRowProcessor) method, but automatically uses an appropriate DbBeanFetcher instance, returns the resulting bean and allows customization of the prepared statement through an optional instance of DbPreparedStatementHandler .

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Select select = new Select(datasource);
 select.from("person").fields(Person.class).whereParameter("name", "=");
 final String name = "you";
 Person person = manager.executeFetchFirstBean(select, Person.class, new DbPreparedStatementHandler() {
 public void setParameters(DbPreparedStatement statement)
 {
 statement
 .setString("name", name);
 }
 });

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  beanClass - the class of the bean
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all true if a row was retrieved; or

false if there are no more rows .
exception:
  DatabaseException - see DbBeanFetcher and DbQueryManager.executeFetchFirst(ReadQuery,DbRowProcessor)
See Also:   DbQueryManager.executeFetchFirst(ReadQuery,DbRowProcessor)
See Also:   DbBeanFetcher
since:
   1.0




executeGetFirstBoolean
public boolean executeGetFirstBoolean(ReadQuery query) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed the first boolean in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstBoolean
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstBoolean
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstBoolean
public boolean executeGetFirstBoolean(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first boolean in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstBoolean
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstBoolean
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstByte
public byte executeGetFirstByte(ReadQuery query) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed the first byte in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstByte
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstByte
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstByte
public byte executeGetFirstByte(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first byte in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstByte
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstByte
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstBytes
public byte[] executeGetFirstBytes(ReadQuery query) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed the first byte array in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstBytes
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstBytes
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstBytes
public byte[] executeGetFirstBytes(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first byte array in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstBytes
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstBytes
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstDate
public java.sql.Date executeGetFirstDate(ReadQuery query) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a sql 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 DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed the first sql Date in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstDate
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstDate
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstDate
public java.sql.Date executeGetFirstDate(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a sql Date from the results of a customizable select query. It relies on the wrapped DbResultSet.getFirstDate 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first sql Date in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstDate
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstDate
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstDate
public java.sql.Date executeGetFirstDate(ReadQuery query, Calendar cal) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a sql Date from the results of a select query. It relies on the wrapped DbResultSet.getFirstDate(Calendar) method, but also automatically closes the statement after its execution.

Refer to DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  cal - the Calendar object to use in constructing thedate the first sql Date in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstDate(Calendar)
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstDate(Calendar)
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstDate
public java.sql.Date executeGetFirstDate(ReadQuery query, Calendar cal, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a sql Date from the results of a customizable select query. It relies on the wrapped DbResultSet.getFirstDate(Calendar) 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  cal - the Calendar object to use in constructing thedate
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first sql Date in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstDate(Calendar)
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstDate(Calendar)
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstDouble
public double executeGetFirstDouble(ReadQuery query) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed the first double in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstDouble
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstDouble
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstDouble
public double executeGetFirstDouble(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first double in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstDouble
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstDouble
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstFloat
public float executeGetFirstFloat(ReadQuery query) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed the first float in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstFloat
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstFloat
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstFloat
public float executeGetFirstFloat(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first float in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstFloat
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstFloat
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstInt
public int executeGetFirstInt(ReadQuery query) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed the first int in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstInt
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstInt
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstInt
public int executeGetFirstInt(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first int in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstInt
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstInt
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstLong
public long executeGetFirstLong(ReadQuery query) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed the first long in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstLong
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstLong
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstLong
public long executeGetFirstLong(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first long in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstLong
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstLong
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstShort
public short executeGetFirstShort(ReadQuery query) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed the first short in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstShort
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstShort
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstShort
public short executeGetFirstShort(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first short in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstShort
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstShort
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstString
public String executeGetFirstString(ReadQuery query) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a 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.

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Select select = new Select(datasource);
 select.field("name").from("person");
 String result = manager.executeGetFirstString(select);
 

Parameters:
  query - the query builder instance that needs to be executed the first String in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstString
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstString
See Also:   DbPreparedStatementHandler
since:
   1.0



executeGetFirstString
public String executeGetFirstString(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a 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 .

Example

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);
 }
 });

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first String in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstString
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstString
See Also:   DbPreparedStatementHandler
since:
   1.0



executeGetFirstTime
public java.sql.Time executeGetFirstTime(ReadQuery query) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a sql Time from the results of a select query. It relies on the wrapped DbResultSet.getFirstTime method, but also automatically closes the statement after its execution.

Refer to DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed the first sql Time in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstTime
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstTime
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstTime
public java.sql.Time executeGetFirstTime(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a sql Time from the results of a customizable select query. It relies on the wrapped DbResultSet.getFirstTime 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first sql Time in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstTime
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstTime
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstTime
public java.sql.Time executeGetFirstTime(ReadQuery query, Calendar cal) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a sql Time from the results of a select query. It relies on the wrapped DbResultSet.getFirstTime(Calendar) method, but also automatically closes the statement after its execution.

Refer to DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  cal - the Calendar object to use in constructing thetime the first sql Time in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstTime(Calendar)
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstTime(Calendar)
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstTime
public java.sql.Time executeGetFirstTime(ReadQuery query, Calendar cal, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a sql Time from the results of a customizable select query. It relies on the wrapped DbResultSet.getFirstTime(Calendar) 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  cal - the Calendar object to use in constructing thetime
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first sql Time in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstTime(Calendar)
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstTime(Calendar)
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstTimestamp
public java.sql.Timestamp executeGetFirstTimestamp(ReadQuery query) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a sql Timestamp from the results of a select query. It relies on the wrapped DbResultSet.getFirstTimestamp method, but also automatically closes the statement after its execution.

Refer to DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed the first sql Timestamp in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstTimestamp
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstTimestamp
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstTimestamp
public java.sql.Timestamp executeGetFirstTimestamp(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a sql Timestamp from the results of a customizable select query. It relies on the wrapped DbResultSet.getFirstTimestamp 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first sql Timestamp in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstTimestamp
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstTimestamp
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstTimestamp
public java.sql.Timestamp executeGetFirstTimestamp(ReadQuery query, Calendar cal) throws DatabaseException(Code)
Safely and quickly retrieves the first cell as a sql Timestamp from the results of a select query. It relies on the wrapped DbResultSet.getFirstTimestamp(Calendar) method, but also automatically closes the statement after its execution.

Refer to DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  cal - the Calendar object to use in constructing thetimestamp the first sql Timestamp in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstTimestamp(Calendar)
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstTimestamp(Calendar)
See Also:   DbPreparedStatementHandler
since:
   1.0




executeGetFirstTimestamp
public java.sql.Timestamp executeGetFirstTimestamp(ReadQuery query, Calendar cal, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely retrieves the first cell as a sql Timestamp from the results of a customizable select query. It relies on the wrapped DbResultSet.getFirstTimestamp(Calendar) 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  cal - the Calendar object to use in constructing thetimestamp
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the first sql Timestamp in the query's resultset
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstTimestamp(Calendar)
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstTimestamp(Calendar)
See Also:   DbPreparedStatementHandler
since:
   1.0




executeHasResultRows
public boolean executeHasResultRows(ReadQuery query) throws DatabaseException(Code)
Safely and quickly verifies if a select query returns any rows. It relies on the wrapped DbResultSet.hasResultRows method, but also automatically closes the statement after its execution.

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Select select = new Select(datasource);
 select.from("person");
 boolean result = manager.executeHasResultRows(select);
 

Parameters:
  query - the query builder instance that needs to be executed true when rows were returned by the query; or

false otherwise
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.hasResultRows
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.hasResultRows
See Also:   DbPreparedStatementHandler
since:
   1.0




executeHasResultRows
public boolean executeHasResultRows(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely verifies if a customizable select query returns any rows. It relies on the wrapped 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 .

Example

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);
 }
 });

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all true when rows were returned by the query; or

false otherwise
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.hasResultRows
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.hasResultRows
See Also:   DbPreparedStatementHandler
since:
   1.0




executeQuery
public ResultType executeQuery(ReadQuery query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Executes a customizable select statement. It relies on the wrapped DbPreparedStatement.executeQuery method, but also automatically closes the statement after its execution and allows complete 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. Often another more specialized method in this class will already serve your needs, so be sure to verify that you actually need to intervene on every front.

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Select select = new Select(datasource);
 select
 .field("first")
 .field("last")
 .from("person")
 .whereParameter("name", "=");
 final String name = "you";
 String result = (String)manager.executeQuery(select, new DbPreparedStatementHandler() {
 public void setParameters(DbPreparedStatement statement)
 {
 statement
 .setString("name", name);
 }
 public Object concludeResults(DbResultSet resultset)
 throws SQLException
 {
 return resultset.getString("first")+" "+resultset.getString("last");
 }
 });

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the object that was returned by the overridden DbResultSetHandler.concludeResults(DbResultSet) concludeResultsmethod; or

null if this method wasn't overridden
exception:
  DatabaseException - see DbPreparedStatement.executeQuery
See Also:   DbPreparedStatement.executeQuery
See Also:   DbPreparedStatementHandler
since:
   1.0




executeQuery
public ResultType executeQuery(ReadQuery query, DbResultSetHandler handler) throws DatabaseException(Code)
Executes a select statement and handle the results in a custom fashion. It relies on the wrapped DbPreparedStatement.executeQuery method, but also automatically closes the statement after its execution and allows interaction with the resultset through an optional instance of DbResultSetHandler .

This method is typically used when you need to interact with the results of a query, but still want to benefit of a safety net that ensures that the allocated statement will be closed. Often another more specialized method in this class will already serve your needs, so be sure to verify that there isn't another one that's better suited.

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Select select = new Select(datasource);
 select
 .field("first")
 .field("last")
 .from("person");
 String result = (String)manager.executeQuery(select, new DbResultSetHandler() {
 public Object concludeResults(DbResultSet resultset)
 throws SQLException
 {
 return resultset.getString("first")+" "+resultset.getString("last");
 }
 });

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbResultSetHandlerthat will be used to handle the results of the query execution; ornull if you don't want to customize it at all the object that was returned by the overridden DbResultSetHandler.concludeResults(DbResultSet) concludeResultsmethod; or

null if this method wasn't overridden
exception:
  DatabaseException - see DbPreparedStatement.executeQuery
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSetHandler
since:
   1.0




executeQuery
public DbStatement executeQuery(ReadQuery query) throws DatabaseException(Code)
Executes a query statement in a connection of this DbQueryManager's Datasource. Functions exactly as the wrapped DbStatement.executeQuery(ReadQuery) method.

Note that the statement will not be automatically closed since using this method implies that you still have to work with the resultset.
Parameters:
  query - the query builder instance that should be executed the statement that has been executed
exception:
  DatabaseException - see DbStatement.executeQuery(ReadQuery)
See Also:   DbStatement.executeQuery(ReadQuery)
since:
   1.0




executeUpdate
public int executeUpdate(String sql) throws DatabaseException(Code)
Safely and quickly executes an update statement. It relies on the wrapped 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.

Example

DbQueryManager manager = new DbQueryManager(datasource);
 int count = manager.executeUpdate("INSERT INTO person (name) VALUES ('me')");

Parameters:
  sql - the sql query that has to be executed the row count for the executed query
exception:
  DatabaseException - see DbStatement.executeUpdate(String)
See Also:   DbStatement.executeUpdate(String)
See Also:   DbQueryManager.executeUpdate(Query)
since:
   1.0



executeUpdate
public int executeUpdate(Query query) throws DatabaseException(Code)
Safely and quickly executes an update statement. It relies on the wrapped 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.

Example

DbQueryManager manager = new DbQueryManager(datasource);
 Insert insert = new Insert(datasource);
 insert.into("person").field("name", "me");
 int count = manager.executeUpdate(insert);

Parameters:
  query - the query builder instance that needs to be executed the row count for the executed query
exception:
  DatabaseException - see DbStatement.executeUpdate(Query)
See Also:   DbStatement.executeUpdate(Query)
See Also:   DbQueryManager.executeUpdate(String)
since:
   1.0



executeUpdate
public int executeUpdate(Query query, DbPreparedStatementHandler handler) throws DatabaseException(Code)
Safely execute an updates statement. It relies on the wrapped 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.

Example

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);
 }
 });

Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the row count for the executed query
exception:
  DatabaseException - see DbPreparedStatement.executeUpdate
See Also:   DbPreparedStatement.executeUpdate
See Also:   DbPreparedStatementHandler
since:
   1.0



executeUseFirstAsciiStream
public ResultType executeUseFirstAsciiStream(ReadQuery query, InputStreamUser user) throws DatabaseException, InnerClassException(Code)
Safely and quickly retrieves the first cell as an ASCII InputStream from the results of a select query. It relies on the wrapped DbResultSet.getFirstAsciiStream method, but also automatically closes the statement after its execution.

Refer to DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  user - an instance of InputStreamUserthat contains the logic that will be executed with this stream the return value from the useInputStream method ofthe provided InputStreamUser instance
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstAsciiStream
exception:
  InnerClassException - when errors occurs inside theInputStreamUser
See Also:   InputStreamUser
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstAsciiStream
See Also:   DbPreparedStatementHandler
since:
   1.0




executeUseFirstAsciiStream
public ResultType executeUseFirstAsciiStream(ReadQuery query, InputStreamUser user, DbPreparedStatementHandler handler) throws DatabaseException, InnerClassException(Code)
Safely retrieves the first cell as an ASCII InputStream from the results of a customizable select query. It relies on the wrapped DbResultSet.getFirstAsciiStream 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  user - an instance of InputStreamUserthat contains the logic that will be executed with this stream
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the return value from the useInputStream method ofthe provided InputStreamUser instance
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstAsciiStream
exception:
  InnerClassException - when errors occurs inside theInputStreamUser
See Also:   InputStreamUser
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstAsciiStream
See Also:   DbPreparedStatementHandler
since:
   1.0




executeUseFirstBinaryStream
public ResultType executeUseFirstBinaryStream(ReadQuery query, InputStreamUser user) throws DatabaseException, InnerClassException(Code)
Safely and quickly retrieves the first cell as an binary InputStream from the results of a select query. It relies on the wrapped DbResultSet.getFirstBinaryStream method, but also automatically closes the statement after its execution.

Refer to DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  user - an instance of InputStreamUserthat contains the logic that will be executed with this stream the return value from the useInputStream method ofthe provided InputStreamUser instance
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstBinaryStream
exception:
  InnerClassException - when errors occurs inside theInputStreamUser
See Also:   InputStreamUser
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstBinaryStream
See Also:   DbPreparedStatementHandler
since:
   1.0




executeUseFirstBinaryStream
public ResultType executeUseFirstBinaryStream(ReadQuery query, InputStreamUser user, DbPreparedStatementHandler handler) throws DatabaseException, InnerClassException(Code)
Safely retrieves the first cell as an binary InputStream from the results of a customizable select query. It relies on the wrapped DbResultSet.getFirstBinaryStream 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  user - an instance of InputStreamUserthat contains the logic that will be executed with this stream
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the return value from the useInputStream method ofthe provided InputStreamUser instance
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstBinaryStream
exception:
  InnerClassException - when errors occurs inside theInputStreamUser
See Also:   InputStreamUser
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstBinaryStream
See Also:   DbPreparedStatementHandler
since:
   1.0




executeUseFirstCharacterStream
public ResultType executeUseFirstCharacterStream(ReadQuery query, ReaderUser user) throws DatabaseException, InnerClassException(Code)
Safely and quickly retrieves the first cell as an character Reader from the results of a select query. It relies on the wrapped DbResultSet.getFirstCharacterStream method, but also automatically closes the statement after its execution.

Refer to DbQueryManager.executeGetFirstString(ReadQuery) executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  user - an instance of ReaderUserthat contains the logic that will be executed with this reader the return value from the useReader method ofthe provided ReaderUser instance
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstCharacterStream
exception:
  InnerClassException - when errors occurs inside theReaderUser
See Also:   ReaderUser
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstCharacterStream
See Also:   DbPreparedStatementHandler
since:
   1.0




executeUseFirstCharacterStream
public ResultType executeUseFirstCharacterStream(ReadQuery query, ReaderUser user, DbPreparedStatementHandler handler) throws DatabaseException, InnerClassException(Code)
Safely retrieves the first cell as an character Reader from the results of a customizable select query. It relies on the wrapped DbResultSet.getFirstCharacterStream 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 DbQueryManager.executeGetFirstString(ReadQuery,DbPreparedStatementHandler)executeGetFirstString for an example code snippet, it's 100% analogue.
Parameters:
  query - the query builder instance that needs to be executed
Parameters:
  user - an instance of ReaderUserthat contains the logic that will be executed with this reader
Parameters:
  handler - an instance of DbPreparedStatementHandlerthat will be used to customize the query execution; ornull if you don't want to customize it at all the return value from the useReader method ofthe provided ReaderUser instance
exception:
  DatabaseException - see DbPreparedStatement.executeQueryand DbResultSet.getFirstCharacterStream
exception:
  InnerClassException - when errors occurs inside theReaderUser
See Also:   ReaderUser
See Also:   DbPreparedStatement.executeQuery
See Also:   DbResultSet.getFirstCharacterStream
See Also:   DbPreparedStatementHandler
since:
   1.0




fetch
public boolean fetch(ResultSet resultSet) throws DatabaseException(Code)
Fetches the next row of a resultset without processing it in any way.
Parameters:
  resultSet - a valid ResultSet instance true if a new row was retrieved; or

false if there are no more rows .
exception:
  DatabaseException - when an error occurred during the fetch ofthe next row in the resultset
See Also:   DbQueryManager.fetch(ResultSet,DbRowProcessor)
since:
   1.0




fetch
public boolean fetch(ResultSet resultSet, DbRowProcessor rowProcessor) throws DatabaseException(Code)
Fetches the next row of a resultset and processes it through a DbRowProcessor.
Parameters:
  resultSet - a valid ResultSet instance
Parameters:
  rowProcessor - a DbRowProcessor instance, if it'snull no processing will be performed on the fetched row true if a new row was retrieved; or

false if there are no more rows .
exception:
  DatabaseException - when an error occurred during the fetch ofthe next row in the resultset
See Also:   DbQueryManager.fetch(ResultSet)
See Also:   DbRowProcessor
since:
   1.0




fetchAll
public boolean fetchAll(ResultSet resultSet, DbRowProcessor rowProcessor) throws DatabaseException(Code)
Fetches all the next rows of a resultset and processes it through a DbRowProcessor.
Parameters:
  resultSet - a valid ResultSet instance
Parameters:
  rowProcessor - a DbRowProcessor instance, if it'snull no processing will be performed on the fetched rows true if rows were fetched; or

false if the resultset contained no rows.
exception:
  DatabaseException - when an error occurred during the fetch ofthe next rows in the resultset
See Also:   DbRowProcessor
since:
   1.0




getConnection
public DbConnection getConnection() throws DatabaseException(Code)
Obtains a DbConnection of this DbQueryManager's Datasource. Functions exactly as the wrapped Datasource.getConnection method.
See Also:   Datasource.getConnection
since:
   1.0
exception:
  DatabaseException - see Datasource.getConnection the requested DbConnection



getDatasource
public Datasource getDatasource()(Code)
Retrieves the Datasource of this DbQueryManager. the requested Datasource
since:
   1.0



inTransaction
public ResultType inTransaction(DbTransactionUser user) throws InnerClassException, DatabaseException(Code)
Ensures that all the instructions that are executed in the provided DbTransactionUser instance are executed inside a transaction and committed afterwards. This doesn't mean that a new transaction will always be created. If a transaction is already active, it will simply be re-used. The commit will also only be take place if a new transaction has actually been started, otherwise it's the responsibility of the enclosing code to execute the commit. If an runtime exception occurs during the execution and a new transaction has been started beforehand, it will be automatically rolled back.

If you need to explicitly roll back an active transaction, use the DbTransactionUser.rollback rollback method of the DbTransactionUser class. If you use a regular rollback method, it's possible that you're inside a nested transaction executed and that after the rollback, other logic continues to be executed outside the transaction. Using the correct DbTransactionUser.rollback rollback method, stops the execution of the active DbTransactionUser and breaks out of any number of them nesting.

It's recommended to always use transactions through this method since it ensures that transactional code can be re-used and enclosed in other transactional code. Correctly using the regular transaction-related methods requires great care and planning and often results in error-prone and not reusable code.

Example

final Insert insert = new Insert(mDatasource).into("valuelist").field("value", 232);
 final DbQueryManager manager = new DbQueryManager(datasource);
 manager.inTransaction(new DbTransactionUserWithoutResult() {
 public void useTransactionWithoutResult()
 throws InnerClassException
 {
 manager.executeUpdate(insert);
 manager.executeUpdate(insert);
 }
 });
 

Parameters:
  user - an instance of DbTransactionUser that containsthe logic that will be executed the return value from the useTransaction method ofthe provided DbTransactionUser instance
exception:
  DatabaseException - when errors occurs during the handling ofthe transaction
exception:
  InnerClassException - when errors occurs inside theDbTransactionUser
See Also:   DbTransactionUser.useTransaction
See Also:   DbTransactionUserWithoutResult.useTransactionWithoutResult
since:
   1.0



reserveConnection
public ResultType reserveConnection(DbConnectionUser user) throws InnerClassException, DatabaseException(Code)
Reserves a database connection for a this particular thread for all the instructions that are executed in the provided DbConnectionUser instance.

This is typically used to ensure that a series of operations is done with the same connection, even though a database pool is used in the background.

Example

Person person;
 final Insert store_data = new Insert(datasource).into("person").fields(person);
 final Select get_last_id = new Select(datasource).from("person").field("LAST_INSERT_ID()");
 final DbQueryManager manager = new DbQueryManager(datasource);
 int id = ((Integer)manager.reserveConnection(new DbConnectionUser() {
 public Integer useConnection(DbConnection connection)
 {
 manager.executeUpdate(store_data);
 return new Integer(manager.executeGetFirstInt(get_last_id));
 }
 })).intValue();

Parameters:
  user - an instance of DbConnectionUser that containsthe logic that will be executed the return value from the useConnection method ofthe provided DbConnectionUser instance
exception:
  DatabaseException - when errors occurs during the reservationof a connection for this thread
exception:
  InnerClassException - when errors occurs inside theDbConnectionUser
See Also:   DbConnectionUser.useConnection(DbConnection)
since:
   1.0



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.