|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensubsystems.core.persist.db.DatabaseImpl
org.opensubsystems.core.persist.db.hsqldb.HsqlDBDatabaseImpl
public class HsqlDBDatabaseImpl
Management layer for HSQLDB database (hsqldb.sourceforge.net)
| Field Summary |
|---|
| Fields inherited from class org.opensubsystems.core.persist.db.DatabaseImpl |
|---|
m_bDatabaseSchemaInitialized, m_bDatabaseStarted, m_bDatabaseStartInProgress, m_vdsSchema, MAX_SAFE_LENGTH |
| Constructor Summary | |
|---|---|
HsqlDBDatabaseImpl()
Default constructor for empty database. |
|
| Method Summary | |
|---|---|
void |
createDatabaseInstance()
Method for creating database instance. |
protected void |
createUser(java.sql.Connection cntAdminDBConnection)
Create database user which will be used by connection pool to access the database. |
java.lang.String |
getCurrentTimestampFunctionCall()
Get string which can be used in SQL queries to retrieve timestamp representing current time. |
int |
getDatabaseType()
Returns the type of database currently in use. |
java.lang.String |
getDatabaseTypeIdentifier()
Returns the identifier for the type of database currently in use which can be used to construct package and class names. |
java.lang.Object[] |
getSQLAnalyzeFunctionCall(java.util.Map mapTableNames)
Get DB specific SQL queries for analyzing tables or updating statistics on the tables (it is good for performance). |
java.lang.String |
getSQLCountFunctionCall()
Get string which can be used in SQL queries to retrieve record count. |
int |
getTransactionIsolation(int iTransactionIsolation)
Different databases have different bugs about what they support so this method will take the desired transaction isolation level and convert it to the one supported by database. |
void |
insertAndFetchGeneratedValues(java.sql.Connection dbConnection,
java.sql.PreparedStatement insertStatement,
boolean bIsInDomain,
java.lang.String strTableName,
int iIndex,
BasicDataObject data)
Insert the data, fetch from the database id and generated creation and optionally modification timestamps for the newly created data object. |
boolean |
isCallableStatement(java.lang.String strQuery)
Test if the specified query invokes stored procedure or if it is just a regular prepared statement. |
void |
startDatabaseServer()
Method for starting database instance. |
void |
stop()
Stop the database. After the database is stopped, no more requests can be issued until the database is started again. |
void |
updatedAndFetchGeneratedValues(java.lang.String strDataName,
java.sql.Connection dbConnection,
java.sql.PreparedStatement updateStatement,
boolean bIsInDomain,
java.lang.String strTableName,
int iIndex,
ModifiableDataObject data)
Update the data, check for errors and fetch from the database generated modification timestamps for the updated data object. |
| Methods inherited from class org.opensubsystems.core.persist.db.DatabaseImpl |
|---|
add, add, getAdminConnection, getConnectionTestStatement, getInstance, getInstanceIfStarted, getSelectListResultSetConcurrency, getSelectListResultSetType, hasAbsolutePositioningSupport, hasSelectListRangeSupport, isStarted, preferCountToLast, setInstance, start |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HsqlDBDatabaseImpl()
throws OSSException
OSSException - - problem creating the database| Method Detail |
|---|
public void stop()
throws OSSException
stop in interface Databasestop in class DatabaseImplOSSException - - problems stopping the database
protected void createUser(java.sql.Connection cntAdminDBConnection)
throws OSSException
createUser in class DatabaseImplcntAdminDBConnection - - connection with rights to create users
OSSException - - cannot create user
public void startDatabaseServer()
throws OSSException
startDatabaseServer in class DatabaseImplOSSException - - problem starting the server
public void createDatabaseInstance()
throws OSSException
createDatabaseInstance in class DatabaseImplOSSException - - problem creating the database instancepublic int getDatabaseType()
public java.lang.String getDatabaseTypeIdentifier()
public java.lang.String getCurrentTimestampFunctionCall()
public java.lang.String getSQLCountFunctionCall()
public java.lang.Object[] getSQLAnalyzeFunctionCall(java.util.Map mapTableNames)
mapTableNames - - map of table names the update statistics will be
processed on. Key is the data object data of which
are stored in the table and value is te name of the
table
public int getTransactionIsolation(int iTransactionIsolation)
getTransactionIsolation in interface DatabasegetTransactionIsolation in class DatabaseImpliTransactionIsolation - - desired transaction isolation level
public boolean isCallableStatement(java.lang.String strQuery)
strQuery - - query to test
public void insertAndFetchGeneratedValues(java.sql.Connection dbConnection,
java.sql.PreparedStatement insertStatement,
boolean bIsInDomain,
java.lang.String strTableName,
int iIndex,
BasicDataObject data)
throws java.sql.SQLException,
OSSException
dbConnection - - connection to use to access the databaseinsertStatement - - statement used to insert the data. This can be
CallableStatement if stored procedure is used.bIsInDomain - - are the data objects maintained in domainsstrTableName - - name of the table where the data are being insertediIndex - - 1 based index of the next parameter value of which can be
set on the statement (last parameter set by caller + 1)data - - data object to update with the fetched values
java.sql.SQLException - - an error has occured
OSSException - - an error has occured
public void updatedAndFetchGeneratedValues(java.lang.String strDataName,
java.sql.Connection dbConnection,
java.sql.PreparedStatement updateStatement,
boolean bIsInDomain,
java.lang.String strTableName,
int iIndex,
ModifiableDataObject data)
throws java.sql.SQLException,
OSSException
strDataName - - name of the data objectdbConnection - - connection to use to access the datavaseupdateStatement - - statement to update data in the database. This
can be CallableStatement if stored procedure is
used.bIsInDomain - - are the data objects maintained in domainsstrTableName - - name of the tableiIndex - - 1 based index of the next parameter value of which can be
set on the statement (last parameter set by caller + 1)data - - data object to update
java.sql.SQLException - - an error has occured
OSSException - - an error has occured
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||