org.opensubsystems.core.persist.db.driver.sybase
Class SybaseDatabaseTestSchema

java.lang.Object
  extended by org.opensubsystems.core.persist.db.DatabaseSchemaImpl
      extended by org.opensubsystems.core.persist.db.ModifiableDatabaseSchemaImpl
          extended by org.opensubsystems.core.persist.db.driver.DatabaseTestSchema
              extended by org.opensubsystems.core.persist.db.driver.sybase.SybaseDatabaseTestSchema
All Implemented Interfaces:
org.opensubsystems.core.persist.db.DatabaseOperations, org.opensubsystems.core.persist.db.DatabaseSchema, org.opensubsystems.core.persist.db.ModifiableDatabaseSchema

public class SybaseDatabaseTestSchema
extends DatabaseTestSchema

This class encapsulates details about creation and upgrade of database schema required to test database driver functionality for tables which are Sybase database specific

Version:
$Id: SybaseDatabaseTestSchema.java,v 1.19 2007/01/07 06:15:02 bastafidli Exp $
Author:
Julo Legeny
Code reviewer:
Miro Halas
Code reviewed:
1.16 2005/07/29 08:49:48 bastafidli

Field Summary
 
Fields inherited from class org.opensubsystems.core.persist.db.driver.DatabaseTestSchema
DBTEST_SCHEMA_NAME, DBTEST_SCHEMA_VERSION, TABLE_NAMES
 
Fields inherited from class org.opensubsystems.core.persist.db.ModifiableDatabaseSchemaImpl
m_mapModifiableTableNames
 
Fields inherited from class org.opensubsystems.core.persist.db.DatabaseSchemaImpl
DATABASE_SCHEMA_PREFIX, DATABASE_SCHEMA_PREFIX_DEFAULT, m_arrDependentSchemas, m_bIsInDomain, m_iSchemaVersion, m_strSchemaName, NL
 
Fields inherited from interface org.opensubsystems.core.persist.db.DatabaseOperations
DBOP_DELETE, DBOP_INSERT, DBOP_SELECT, DBOP_UPDATE
 
Constructor Summary
SybaseDatabaseTestSchema()
          Default constructor.
 
Method Summary
 void create(java.sql.Connection cntDBConnection, java.lang.String strUserName)
          
 void createTestUser(java.sql.Connection cntAdminDBConnection, java.lang.String strDatabaseURL, java.lang.String strUserName, java.lang.String strUserPassword)
          Create test user in the specified database.
 void dropTestUser(java.sql.Connection cntAdminDBConnection, java.lang.String strDatabaseURL, java.lang.String strUserName)
          Drop test user in the specified database.
 int[] executeInsertGeneratedKey2(java.sql.Connection dbConnection, java.lang.String strValue)
          Execute another query to insert to table with generated keys which guarantees return
 int[] executeInsertRow(java.sql.Connection dbConnection, java.lang.String strValue)
          Execute another query to insert to table.
 int executeUpdateTestValue(java.sql.Connection dbConnection, java.lang.String strOldValue, java.lang.String strNewValue)
          Execute query to update test value using stored procedure without parameters
 java.lang.String getInsertGeneratedKey()
          Query to insert to table with generated keys is database specific.
 
Methods inherited from class org.opensubsystems.core.persist.db.driver.DatabaseTestSchema
createDataSource, getInsertSelectQuery, getSelectExceptQuery, getSelectExceptUnionQuery, getSelectExistQuery
 
Methods inherited from class org.opensubsystems.core.persist.db.ModifiableDatabaseSchemaImpl
deleteRelatedData, getModifiableTableNames, handleSQLException
 
Methods inherited from class org.opensubsystems.core.persist.db.DatabaseSchemaImpl
getDependentSchemas, getJoinFromWhere, getName, getOwnerColumnNames, getSchemaPrefix, getVersion, isExistingIndex, isInDomain, upgrade, upgradeView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensubsystems.core.persist.db.DatabaseSchema
getDependentSchemas, getName, getVersion, isInDomain, upgrade
 

Constructor Detail

SybaseDatabaseTestSchema

public SybaseDatabaseTestSchema()
                         throws org.opensubsystems.core.error.OSSException
Default constructor.

Throws:
org.opensubsystems.core.error.OSSException - - error occured.
Method Detail

create

public void create(java.sql.Connection cntDBConnection,
                   java.lang.String strUserName)
            throws java.sql.SQLException

Specified by:
create in interface org.opensubsystems.core.persist.db.DatabaseSchema
Overrides:
create in class DatabaseTestSchema
Throws:
java.sql.SQLException

getInsertGeneratedKey

public java.lang.String getInsertGeneratedKey()
Query to insert to table with generated keys is database specific.

Specified by:
getInsertGeneratedKey in class DatabaseTestSchema
Returns:
String - SQL query to insert to table with generated keys.

executeInsertGeneratedKey2

public int[] executeInsertGeneratedKey2(java.sql.Connection dbConnection,
                                        java.lang.String strValue)
                                 throws java.sql.SQLException
Execute another query to insert to table with generated keys which guarantees return

Specified by:
executeInsertGeneratedKey2 in class DatabaseTestSchema
Parameters:
dbConnection - - database connection
strValue - - value to insert
Returns:
int[] - index 0 - how many records were inserted - index 1 - the value of generated key
Throws:
java.sql.SQLException - - error during insert execute

executeUpdateTestValue

public int executeUpdateTestValue(java.sql.Connection dbConnection,
                                  java.lang.String strOldValue,
                                  java.lang.String strNewValue)
                           throws java.sql.SQLException
Execute query to update test value using stored procedure without parameters

Specified by:
executeUpdateTestValue in class DatabaseTestSchema
Parameters:
dbConnection - - database connection
strOldValue - - old value to be updated
strNewValue - - new value for update
Returns:
int - number of updated records
Throws:
java.sql.SQLException - - error during insert execute

executeInsertRow

public int[] executeInsertRow(java.sql.Connection dbConnection,
                              java.lang.String strValue)
                       throws java.sql.SQLException
Execute another query to insert to table. There will be test if calling of stored procedure will return number of inserted rows.

Specified by:
executeInsertRow in class DatabaseTestSchema
Parameters:
dbConnection - - database connection
strValue - - value to insert
Returns:
int[] - index 0 - how many records were inserted - index 1 - the value of inserted records retrieved from stored procedure
Throws:
java.sql.SQLException - - error during insert execute

createTestUser

public void createTestUser(java.sql.Connection cntAdminDBConnection,
                           java.lang.String strDatabaseURL,
                           java.lang.String strUserName,
                           java.lang.String strUserPassword)
                    throws java.sql.SQLException
Create test user in the specified database.

Specified by:
createTestUser in class DatabaseTestSchema
Parameters:
cntAdminDBConnection - - database connection
strDatabaseURL - - database URL
strUserName - - name of the user that will be created
strUserPassword - - user password
Throws:
java.sql.SQLException - - error during user creation

dropTestUser

public void dropTestUser(java.sql.Connection cntAdminDBConnection,
                         java.lang.String strDatabaseURL,
                         java.lang.String strUserName)
                  throws java.sql.SQLException
Drop test user in the specified database.

Specified by:
dropTestUser in class DatabaseTestSchema
Parameters:
cntAdminDBConnection - - database connection
strDatabaseURL - - database URL
strUserName - - name of the user that will be created
Throws:
java.sql.SQLException - - error during user deletion


Copyright © 2003 - 2006 OpenSubsystems s.r.o.