org.openmobileis.common.util.database.AbstractQueryManager Class Reference

Inheritance diagram for org.openmobileis.common.util.database.AbstractQueryManager:

org.openmobileis.examples.mycrm.data.jdbc.MyCrmLabelQuery org.openmobileis.examples.mycrm.data.jdbc.MyCrmTerminalUserlQuery org.openmobileis.examples.mycrm.data.jdbc.MyCrmUserManagerDBQuery org.openmobileis.examples.server.database.JDBCBaseDataFactory org.openmobileis.modules.common.database.jdbc.JDBCGlobalPropertyQueryManager org.openmobileis.synchro.algo.replication.utils.impl.AtomicObjectQueryManager org.openmobileis.synchro.algo.syncnumber.impl.HSQLSyncNumberQueryManager org.openmobileis.synchro.algo.syncnumber.impl.MSSQLSyncNumberQueryManager org.openmobileis.synchro.algo.syncnumber.impl.OracleSafeServerSyncNumberQueryManager org.openmobileis.synchro.algo.syncnumber.impl.PostgreSQLSyncNumberQueryManager

List of all members.


Detailed Description

Title: OpenMobileIS project source
Description: This class is ths super class of the queries It allows to execute queries through the db manager.

A query is built with : A pattern : SQL query with variables Parameters : Values of the variables defined in the pattern For instance, the query "SELECT * FROM TABLE WHERE ROW1 = val1 AND ROW2 = val2 will have the following pattern : "SELECT * FROM TABLE WHERE ROW1 = %0% AND ROW2 = %1% and the following parameters : {"val1", "val2"}. Note that the name of the variables are a sequential number starting by 0 and inserted between two separators : % The Manager variable contains dbManager instance which provides services to be connected / disconnected to the database as well as a service to get a connection from the pool connection object.

Author:
Philippe Delrieu
Since:
JDK 1.1
Version:
1.0.

Definition at line 53 of file AbstractQueryManager.java.


Public Member Functions

void close ()
 connectDBManager() allows to access to the DB manager to get a statement
ManagerDB getDbManager ()
 Returns the dbManager.

Protected Member Functions

void executeBlobUpdate (String queryPattern, String parameters[], byte[][] blobs) throws DatabaseException
 execute insert or update query with Blob data.
ResultSet executeQuery (String queryPattern, String parameters[]) throws DatabaseException
 executeQuery() allows to execute a query such as "SELECT * FROM TABLE") use SQL syntax to perform queries Connection is not close to keep the resulting resultset.
ResultSet executeDynamicQuery (String queryPattern, java.util.Hashtable variables) throws DatabaseException
 executeQuery() allows to execute a query such as "SELECT * FROM TABLE") use SQL syntax to perform queries Connection is not close to keep the resulting resultset.
void executeUpdate (String queryPattern, String parameters[]) throws DatabaseException
 executeUpdateQuery() allows to execute a query with INSERT, UPDATE or DELETE statements use SQL syntax to perform queries
void executeDynamicUpdate (String queryPattern, java.util.Hashtable variables) throws DatabaseException
 executeUpdateQuery() allows to execute a query with INSERT, UPDATE or DELETE statements use SQL syntax to perform queries Connection is not close to keep the resulting resultset.
String buildQuery (String queryPattern, String parameters[]) throws DatabaseException
 buildQuery() get the query pattern stored in queries and insert the parameters.

Member Function Documentation

void org.openmobileis.common.util.database.AbstractQueryManager.close (  ) 

connectDBManager() allows to access to the DB manager to get a statement

Parameters:
ManagerDB 
Returns:
None
Exceptions:
None close() allows to close the database
Parameters:
None 
Returns:
None
Exceptions:
None 

Definition at line 88 of file AbstractQueryManager.java.

void org.openmobileis.common.util.database.AbstractQueryManager.executeBlobUpdate ( String  queryPattern,
String  parameters[],
byte  blobs[][] 
) throws DatabaseException [protected]

execute insert or update query with Blob data.

Query parameters are indicated with 0% tag and blob data with ? tag. Use SQL syntax to perform queries

Parameters:
String representing the query with parameters in tag
query parameters.
blob data.
Returns:
void
Exceptions:
DatabaseException 

Definition at line 105 of file AbstractQueryManager.java.

ResultSet org.openmobileis.common.util.database.AbstractQueryManager.executeQuery ( String  queryPattern,
String  parameters[] 
) throws DatabaseException [protected]

executeQuery() allows to execute a query such as "SELECT * FROM TABLE") use SQL syntax to perform queries Connection is not close to keep the resulting resultset.

It must be garbaged by calling ManagerDB.getManager().garbageOpenedConnection();;

Parameters:
String representing the query
query parameters.
Returns:
ResultSet : don't forget to close the resultSet after using.
Exceptions:
SQLException 

Definition at line 141 of file AbstractQueryManager.java.

Referenced by org.openmobileis.synchro.algo.syncnumber.impl.PostgreSQLSyncNumberQueryManager.getLastSyncNumber(), org.openmobileis.synchro.algo.syncnumber.impl.OracleSafeServerSyncNumberQueryManager.getLastSyncNumber(), org.openmobileis.synchro.algo.syncnumber.impl.MSSQLSyncNumberQueryManager.getLastSyncNumber(), org.openmobileis.synchro.algo.syncnumber.impl.HSQLSyncNumberQueryManager.getLastSyncNumber(), org.openmobileis.synchro.algo.syncnumber.impl.PostgreSQLSyncNumberQueryManager.getTimeStampForsn(), org.openmobileis.synchro.algo.syncnumber.impl.OracleSafeServerSyncNumberQueryManager.getTimeStampForsn(), org.openmobileis.synchro.algo.syncnumber.impl.MSSQLSyncNumberQueryManager.getTimeStampForsn(), and org.openmobileis.synchro.algo.syncnumber.impl.HSQLSyncNumberQueryManager.getTimeStampForsn().

ResultSet org.openmobileis.common.util.database.AbstractQueryManager.executeDynamicQuery ( String  queryPattern,
java.util.Hashtable  variables 
) throws DatabaseException [protected]

executeQuery() allows to execute a query such as "SELECT * FROM TABLE") use SQL syntax to perform queries Connection is not close to keep the resulting resultset.

It must be garbaged by calling ManagerDB.getManager().garbageOpenedConnection();;

Parameters:
String representing the query
Returns:
ResultSet : don't forget to close the resultSet after using.
Exceptions:
SQLException 

Definition at line 176 of file AbstractQueryManager.java.

void org.openmobileis.common.util.database.AbstractQueryManager.executeUpdate ( String  queryPattern,
String  parameters[] 
) throws DatabaseException [protected]

executeUpdateQuery() allows to execute a query with INSERT, UPDATE or DELETE statements use SQL syntax to perform queries

Close and garbage the connection and pending result.

Parameters:
String representing the query
Returns:
None
Exceptions:
SQLException 

Definition at line 205 of file AbstractQueryManager.java.

void org.openmobileis.common.util.database.AbstractQueryManager.executeDynamicUpdate ( String  queryPattern,
java.util.Hashtable  variables 
) throws DatabaseException [protected]

executeUpdateQuery() allows to execute a query with INSERT, UPDATE or DELETE statements use SQL syntax to perform queries Connection is not close to keep the resulting resultset.

It must be garbaged by calling ManagerDB.getManager().garbageOpenedConnection();;

Parameters:
String representing the query
Returns:
None
Exceptions:
SQLException 

Definition at line 237 of file AbstractQueryManager.java.

String org.openmobileis.common.util.database.AbstractQueryManager.buildQuery ( String  queryPattern,
String  parameters[] 
) throws DatabaseException [protected]

buildQuery() get the query pattern stored in queries and insert the parameters.

Parameters:
String QueryPattern representing the query with the variables
String parameters representing the variable values or piece of sql codes x% represents a variable and code% represents a piece of sql code to replace
Returns:
String : definitive query
Exceptions:
Exception 

Definition at line 296 of file AbstractQueryManager.java.

ManagerDB org.openmobileis.common.util.database.AbstractQueryManager.getDbManager (  ) 

Returns the dbManager.

Returns:
ManagerDB

Reimplemented in org.openmobileis.examples.mycrm.data.jdbc.MyCrmTerminalUserlQuery.

Definition at line 367 of file AbstractQueryManager.java.

References org.openmobileis.common.util.database.ManagerDB.getManager().

Referenced by org.openmobileis.examples.mycrm.data.jdbc.MyCrmLabelSynchroTarget.getAllCollectionObject(), org.openmobileis.synchro.algo.replication.utils.DefaultSynchroAtomicObjectDelegate.getAllModifiedAtomicObjectForServiceSince(), org.openmobileis.synchro.algo.replication.utils.DefaultSynchroAtomicObjectDelegate.getAtomicObject(), org.openmobileis.examples.mycrm.data.jdbc.MyCrmLabelSynchroTarget.getCollectionObjectWithId(), and org.openmobileis.examples.server.synchro.BaseDataFODBSyncTarget.updateCollectionObject().


The documentation for this class was generated from the following file:
Generated on Mon Jan 11 21:19:20 2010 for OpenMobileIS by  doxygen 1.5.4