int |
addRecord(Context aContext,
HashtableFormat aHashtableFormat)
Methods inherited from class com.ibm.btt.services.jdbc.JDBCService |
buildStatementArray, connect, connect, connect, connect, connect, connect, connect, disconnect, getAddPstmt, getAddString, getAutoCommit, getConnectionManager, getConnectionProperties, getConnMgrID, getDatabaseConnection, getDatabaseURL, getDataSourceName, getPassword, getPoolName, getSharedConnection, getUpdateString, getUser, isWaitRetry, requestConnectionToConnectionManager, requestConnectionToConnectionManager, setAddPstmt, setAddString, setAutoCommit, setConnectionManager, setConnectionProperties, setConnMgrID, setDatabaseConnection, setDatabaseURL, setDataSourceName, setPassword, setPoolName, setSharedConnection, setStatementPoolSize, setUpdateString, setUser, setWaitRetry, verifyConnection |
Methods inherited from class com.ibm.btt.base.Service |
externalizer, getExternalizer, getTagName, readExternal, readExternal, readObject, removeExternal, setExternalizer, toString, toTags, writeExternal, writeExternal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.ibm.btt.services.jdbc.DatabaseConnect |
connect, connect, connect, connect, connect, connect, disconnect, getDatabaseURL, getDataSourceName, getPoolName, getSharedConnection, isWaitRetry, setDatabaseURL, setDataSourceName, setPoolName, setSharedConnection, setWaitRetry |
schema
protected java.lang.String schema
- The name of database schema where the store table is created. It is used
to check for the table existence in the database.
catalog
protected java.lang.String catalog
- The name of database catalog where the store table is created. It is used
to check for the table existence in the database.
JDBCDriver
protected java.lang.String JDBCDriver
- Keeps the name of the JDBC driver to be used to access the database.
JDBCStore
public JDBCStore()
- This constructor creates a JDBCStore object.
JDBCStore
public JDBCStore(java.lang.String aTableName)
- This constructor creates a JDBCStore object. It sets the tableName object
attribute to aTableName.
- Parameters:
aTableName - java.lang.String
JDBCStore
public JDBCStore(java.lang.String aSchemaName,
java.lang.String aTableName)
- This constructor creates a JDBCStore object. It sets schema and tableName
object attributes to the values provided as arguments.
- Parameters:
aSchemaName - java.lang.StringaTableName - java.lang.String
JDBCStore
protected JDBCStore(java.lang.String aCatalogName,
java.lang.String aSchemaName,
java.lang.String aTableName)
- This constructor creates a JDBCStore object. It sets the catalog, schema,
and tableName object attributes to the values provided as arguments.
- Parameters:
aCatalogName - java.lang.StringaSchemaName - java.lang.StringaTableName - java.lang.String
addRecord
public int addRecord(Context aContext,
HashtableFormat aHashtableFormat)
throws DSEInvalidArgumentException,
DSEInvalidRequestException,
DSEInternalErrorException,
DSESQLException,
DSEInvalidClassException
- Builds a data Hashtable by calling the format method of the
aHashtableFormat with the aContext as an argument. The returned Hashtable
instance is then passed as parameter of the addRecord(Hashtable) method.
- Specified by:
addRecord in interface StoreService - Specified by:
addRecord in class Store
- Parameters:
aContext - com.ibm.dse.base.ContextaHashtableFormat - com.ibm.dse.base.HashtableFormat
- Returns:
- int - the table row number where the record has been inserted
- Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidClassException - if there is an error in the formatting process
addRecord
public int addRecord(Context aContext,
java.lang.String aFormatName)
throws DSEInvalidArgumentException,
DSEInvalidRequestException,
DSEInternalErrorException,
DSESQLException,
DSEInvalidClassException,
java.io.IOException
- Instantiates the store formatter with the name aFormatName and calls its
format method by passing aContext as an argument. The returned object, a
Hashtable instance, is then used to build the store record and insert it
into the database by calling the addRecord(Hashtable) method.
- Specified by:
addRecord in interface StoreService - Specified by:
addRecord in class Store
- Parameters:
aContext - com.ibm.dse.base.Context - the context that keeps the dataaFormatName - java.lang.String - the store formatter name
- Returns:
- int - the table row number where the record has been inserted
- Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidClassException - if there is an error in the formatting process
java.io.IOException - if there is an error instanciating the formatter from its
external definition
addRecord
public int addRecord(Hashtable aDataHashtable)
throws DSEInvalidRequestException,
DSEInvalidArgumentException,
DSEInternalErrorException,
DSESQLException
- Inserts the data from aDataHashtable as a new row into the current Store
table. The data Hashtable has the format: key=data_field_name,
value=data_field_value.
- Specified by:
addRecord in interface StoreService - Specified by:
addRecord in class Store
- Parameters:
aDataHashtable - Hashtable - the Hashtable with the data
- Returns:
- int - the table row number where the record has been inserted
- Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
buildAddString
protected void buildAddString()
throws DSESQLException,
DSEInternalErrorException,
DSEInvalidRequestException,
DSEInvalidArgumentException,
DSEException
- Builds an instance variable that will be used when adding a record.
- Specified by:
buildAddString in class JDBCService
- Throws:
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSESQLException - if an SQLException is caught
DSEObjectNotFoundException - if the JDBCServicesConnectionManager cannot be found
DSEException - if an exception is thrown when calling the pool of
connections manager
buildConnectionProperties
protected void buildConnectionProperties()
- Build the Hashtable containing all details needed to request the database
connection. It is called by the initializeFrom() method.
- Overrides:
buildConnectionProperties in class JDBCService
buildUpdateString
protected void buildUpdateString()
throws DSESQLException,
DSEInternalErrorException,
DSEInvalidRequestException,
DSEInvalidArgumentException,
DSEException
- Builds an instance variable that will be used when updating all columns
of a record.
- Specified by:
buildUpdateString in class JDBCService
- Throws:
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSESQLException - if an SQLException is caught
DSEObjectNotFoundException - if the JDBCServicesConnectionManager cannot be found
DSEException - if an exception is thrown when calling the pool of
connections manager
commit
public void commit()
throws DSESQLException
- Commits all changes to the database. Nothing is done if the autoCommit
attribute has been set to true.
- Specified by:
commit in interface StoreService - Specified by:
commit in class Store
- Throws:
DSESQLException - if commit fails
deleteAllRetrievedForForwarding
public int deleteAllRetrievedForForwarding()
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Deletes all records marked as retrievedForForwarding from the store
table.
- Specified by:
deleteAllRetrievedForForwarding in interface StoreService - Specified by:
deleteAllRetrievedForForwarding in class Store
- Returns:
- int - the row count (number of deleted records)
- Throws:
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSESQLException - if an SQLException is caught
deleteRecord
public int deleteRecord(int aRecordId)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Deletes the record identified with aRecordId from the store table. Only
the records marked as retrievedForForwarding or with a mark other than
added or updated can be deleted.
- Specified by:
deleteRecord in interface StoreService - Specified by:
deleteRecord in class Store
- Parameters:
aRecordId - int
- Returns:
- int - the row count (number of deleted records)
- Throws:
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSESQLException - if an SQLException is caught
deleteRecords
public int deleteRecords(java.lang.String aSelectionCriteria)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Deletes all the records within the store table that match the selection
criteria.
- Specified by:
deleteRecords in interface StoreService - Specified by:
deleteRecords in class Store
- Parameters:
aSelectionCriteria - java.lang.String - the selection criteria in SQL format
- Returns:
- int - the row count (number of deleted records)
- Throws:
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSESQLException - if an SQLException is caught
getCatalogName
public java.lang.String getCatalogName()
- Returns the catalog attribute value.
- Returns:
- java.lang.String
getColumnsTable
public Hashtable getColumnsTable()
- Returns the columnsTable attribute value.
- Returns:
- com.ibm.dse.base.Hashtable
getFullTableName
public java.lang.String getFullTableName()
- Gets the full table name (schemaName + tableName).
getJDBCDriver
public java.lang.String getJDBCDriver()
- Returns the JDBCDriver attribute value.
- Returns:
- java.lang.String
getLastRecordNumber
public int getLastRecordNumber()
- Gets the lastRecordNumber attribute value of this Db2Store instance.
- Parameters:
aRecordNumber - int - the store table last record number
getSchemaName
public java.lang.String getSchemaName()
- Returns the schema attribute value.
- Returns:
- java.lang.String
initializeColumnFrom
public java.lang.Object initializeColumnFrom(Tag aTag)
- Called from the initializeFrom(Tag aTag) method to set the columnsTable
attribute of the JDBCStore instance being created.
- Parameters:
aTag - com.ibm.dse.base.Tag
- Returns:
- java.lang.Object - the JDBCStore instance
initializeFrom
public java.lang.Object initializeFrom(Tag aTag)
throws java.io.IOException
- Called by the externalizer to set JDBCStore instance attributes to the
values set in the services XML file.
- Overrides:
initializeFrom in class Service
- Parameters:
aTag - com.ibm.dse.base.Tag
- Returns:
- java.lang.Object - the JDBCStore instance
- Throws:
java.io.IOException - if an I/O Exception has occurred
isConnected
public boolean isConnected()
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSESQLException,
DSEException
- Returns true if there is a connection to the database or false if there
is not.
- Specified by:
isConnected in interface DatabaseConnect - Overrides:
isConnected in class JDBCService
- Returns:
- boolean
- Throws:
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEException - if an exception is thrown when calling the pool of
connections manager
loadDriver
public void loadDriver()
throws DSEInternalErrorException
- Loads the JDBC Driver as set in the external definition of the service or
the default database JDBC Driver as set in the StoreConstants specific
attribute.
- Throws:
DSEInternalErrorException - if an internal program error occurs
loadDriver
public void loadDriver(java.lang.String aDriverName)
throws DSEInternalErrorException
- Loads the specified database JDBC Driver.
- Parameters:
aDriverName - java.lang.String, the driver name (full path)
- Throws:
DSEInternalErrorException - if an internal program error occurs
markRecordRetrievedForForwarding
public void markRecordRetrievedForForwarding(int aRecordId)
throws DSEInternalErrorException,
DSESQLException
- Marks the store table record that has an identifier that equals aRecordId
as the retrievedForForwarding.
- Specified by:
markRecordRetrievedForForwarding in class Store
- Parameters:
aRecordId - int - the record identifier
- Throws:
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
newFor
public static JDBCStore newFor(java.lang.String aTableName)
throws java.io.IOException
- Returns a new JDBCStore instance with its tableName attribute set to
aTableName.
- Parameters:
aTableName - java.lang.String - the name of the store table
- Returns:
- JDBCStore - the new JDBCStore instance
- Throws:
java.io.IOException - if an I/O exception has occurred.
newFor
public static JDBCStore newFor(java.lang.String aSchemaName,
java.lang.String aTableName)
throws java.io.IOException
- Returns a new JDBCStore instance with its tableName attribute set to
aTableName.
- Parameters:
aSchemaName - java.lang.String - the name of the schema in which the store
table is created (if it applies to the DBMS being used)aTableName - java.lang.String - the name of the store table
- Returns:
- JDBCStore - the new JDBCStore instance
- Throws:
java.io.IOException - if an I/O exception has occurred.
newFor
protected static JDBCStore newFor(java.lang.String aCatalogName,
java.lang.String aSchemaName,
java.lang.String aTableName)
throws java.io.IOException
- Returns a new JDBCStore instance with its tableName attribute set to
aTableName.
- Parameters:
aCatalogName - java.lang.String - the name of the catalog in which the store
table is created (if it applies to the DBMS being used)aSchemaName - java.lang.String - the name of the schema in which the store
table is created (if it applies to the DBMS being used)aTableName - java.lang.String - the name of the store table
- Returns:
- JDBCStore - the new JDBCStore instance
- Throws:
java.io.IOException - if an I/O exception has occurred.
retrieveFirstRecord
public Hashtable retrieveFirstRecord()
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Returns the first record in the store table or null if the table is
empty.
- Specified by:
retrieveFirstRecord in interface StoreService - Specified by:
retrieveFirstRecord in class Store
- Returns:
- com.ibm.dse.base.Hashtable - the Hashtable containing the first
record columns values
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveFirstRecord
public int retrieveFirstRecord(Context aContext,
HashtableFormat aHashtableFormat)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves the first record in the store table and returns its recordId.
The method calls the unformat method of the formatter HashtableFormat
passing aContext as an argument. The aContext is automatically updated
with the values of the retrieved record columns.
- Specified by:
retrieveFirstRecord in interface StoreService - Specified by:
retrieveFirstRecord in class Store
- Parameters:
aContext - com.ibm.dse.base.Context the context where to put the
retrieved record dataaHashtableFormat - com.ibm.dse.base.HashtableFormat the formatter to be used to
update the context
- Returns:
- int - the recordId of the first record
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveFirstRecord
public int retrieveFirstRecord(Context aContext,
java.lang.String aFormatName)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException,
java.io.IOException
- Retrieves the first record in the store table and returns its recordId.
The method calls the unformat method of the formatter defined by
aFormatName passing the aContext as an argument. The aContext is
automatically updated with the values of the retrieved record columns.
- Specified by:
retrieveFirstRecord in interface StoreService - Specified by:
retrieveFirstRecord in class Store
- Parameters:
aContext - com.ibm.dse.base.Context - the context where to put the
retrieved record dataaFormatName - java.lang.String - the name of the formatter to be used to
update the context
- Returns:
- int - the recordId of the first record
- Throws:
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSESQLException - if an SQL Exception is caught
java.io.IOException - if there is an error instanciating the formatter from its
external definition
retrieveFirstRecordForForwarding
public Hashtable retrieveFirstRecordForForwarding()
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Returns the first record in the store table or null if the table is
empty. When the record is found, it is marked as retrievedForForwarding.
The returned object is a Hashtable with the key equal to the data field
name and the value equal to the value stored in the corresponding record
column as a Java object.
- Specified by:
retrieveFirstRecordForForwarding in interface StoreService - Specified by:
retrieveFirstRecordForForwarding in class Store
- Returns:
- com.ibm.dse.base.Hashtable
- Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveFirstRecordForForwarding
public void retrieveFirstRecordForForwarding(Context aContext,
HashtableFormat aHashtableFormat)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves, using the retrieveFirstRecord(Context,HashtableFormat) method,
the first record in the store table or null if the table is empty. When
the record is found, the method marks it as retrievedForForwarding. The
aContext is automatically updated with the retrieved record columns
values.
- Specified by:
retrieveFirstRecordForForwarding in interface StoreService - Specified by:
retrieveFirstRecordForForwarding in class Store
- Parameters:
aContext - com.ibm.dse.base.ContextaHashtableFormat - com.ibm.dse.base.HashtableFormat
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveFirstRecordForForwarding
public void retrieveFirstRecordForForwarding(Context aContext,
java.lang.String aFormatName)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException,
java.io.IOException
- Retrieves, using the retrieveFirstRecord(Context,HashtableFormat) method,
the first record in the store table or null if the table is empty. When
the record is found, the method marks it as retrievedForForwarding. The
aContext is automatically updated with the retrieved record columns
values.
- Specified by:
retrieveFirstRecordForForwarding in interface StoreService - Specified by:
retrieveFirstRecordForForwarding in class Store
- Parameters:
aContext - com.ibm.dse.base.ContextaFormatName - java.lang.String
- Throws:
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSESQLException - if an SQL Exception is caught
java.io.IOException - if there is an error instanciating the formatter from its
external definition
retrieveLastRecordNumber
public int retrieveLastRecordNumber()
throws DSESQLException,
DSEInternalErrorException
- Returns the last record number. It is used to set the record
identification of the next record to be inserted. The SQL statement to do
this is:
SELECT * FROM getTableName() WHERE DSERECID=(SELECT MAX(DSERECID) FROM getTableName())
This will return the last record inserted in the table. Then, from the
ResultSet, the value in the DSERECID may be obtained and returned.
- Returns:
- int
- Throws:
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveNextRecord
public Hashtable retrieveNextRecord()
throws DSEInternalErrorException,
DSEInvalidRequestException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves the next record from the current cursor in the store table.
- Specified by:
retrieveNextRecord in interface StoreService - Specified by:
retrieveNextRecord in class Store
- Returns:
- com.ibm.dse.base.Hashtable - the Hashtable containing the record
columns values
- Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveNextRecord
public int retrieveNextRecord(Context aContext,
HashtableFormat aHashtableFormat)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves the next record from the current cursor in the store table and
returns its recordId. The method calls the unformat method of the
aHashtableFormat formatter and passes the aContext as an argument. The
aContext is automatically updated with the retrieved record columns
values.
- Specified by:
retrieveNextRecord in interface StoreService - Specified by:
retrieveNextRecord in class Store
- Parameters:
aContext - com.ibm.dse.base.ContextaHashtableFormat - com.ibm.dse.base.HashtableFormat
- Returns:
- int - the recordId of the retrieved record
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveNextRecord
public int retrieveNextRecord(Context aContext,
java.lang.String aFormatName)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSEInvalidRequestException,
DSESQLException,
java.io.IOException
- Retrieves the next record from the current cursor in the store table and
returns its recordId. The method calls the unformat method of the
formatter defined by aFormatName, passing the aContext as an argument.
The aContext is automatically updated with the retrieved record columns
values.
- Specified by:
retrieveNextRecord in interface StoreService - Specified by:
retrieveNextRecord in class Store
- Parameters:
aContext - com.ibm.dse.base.ContextaFormatName - java.lang.String
- Returns:
- int - the recordId of the retrieved record
- Throws:
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSESQLException - if an SQLException is caught
java.io.IOException - if there is an error instanciating the formatter from its
external definition
retrieveNextRecordForForwarding
public Hashtable retrieveNextRecordForForwarding()
throws DSEInternalErrorException,
DSEInvalidRequestException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves the next record from the current cursor in the store table and
marks it as retrievedForForwarding.
- Specified by:
retrieveNextRecordForForwarding in interface StoreService - Specified by:
retrieveNextRecordForForwarding in class Store
- Returns:
- com.ibm.dse.base.Hashtable the Hashtable containing the record
columns values
- Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInvalidRequestException - if the request is not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveNextRecordForForwarding
public void retrieveNextRecordForForwarding(Context aContext,
HashtableFormat aHashtableFormat)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves the next record from the current cursor in the store table by
using the retrieveNextRecord(Context,HashtableFormat) method. When the
record is found, it is marked as retrievedForForwarding.
- Specified by:
retrieveNextRecordForForwarding in interface StoreService - Specified by:
retrieveNextRecordForForwarding in class Store
- Parameters:
aContext - com.ibm.dse.base.ContextaHashtableFormat - com.ibm.dse.base.HashtableFormat
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveNextRecordForForwarding
public void retrieveNextRecordForForwarding(Context aContext,
java.lang.String aFormatName)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSEInvalidRequestException,
DSESQLException,
java.io.IOException
- Retrieves the next record from the current cursor in the store table,
using the retrieveFirstRecord(Context,FormatName) method and marks it as
retrievedForForwarding. When the record is found, it is marked as
retrievedForForwarding.
- Specified by:
retrieveNextRecordForForwarding in interface StoreService - Specified by:
retrieveNextRecordForForwarding in class Store
- Parameters:
aContext - com.ibm.dse.base.ContextaFormatName - java.lang.String
- Throws:
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - is an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSESQLException - is an SQLException is caught
java.io.IOException - if there is an error instanciating the formatter from its
external definition
retrieveRecord
public Hashtable retrieveRecord(int aRecordId)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves a record of the store table with an specific recordId.
- Specified by:
retrieveRecord in interface StoreService - Specified by:
retrieveRecord in class Store
- Parameters:
aRecordId - int - the record Identifier
- Returns:
- Hashtable - the Hashtable containing the record columns values
- Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveRecord
public void retrieveRecord(int aRecordId,
Context aContext,
HashtableFormat aHashtableFormat)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves a record of the store table with an specific recordId. The
retrieved record is unformated into aContext using aHashtableFormat.
- Specified by:
retrieveRecord in interface StoreService - Specified by:
retrieveRecord in class Store
- Parameters:
aContext - com.ibm.dse.base.ContextaSelectionCriteria - java.lang.StringaContext - com.ibm.dse.base.ContextaHashtableFormat - com.ibm.dse.base.HashtableFormat
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveRecord
public void retrieveRecord(int aRecordId,
Context aContext,
java.lang.String aFormatName)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSEInvalidRequestException,
DSESQLException,
java.io.IOException
- Retrieves a record of the store table with an specific recordId. The
retrieved record is unformated into aContext using the aFormatName
formatter.
- Specified by:
retrieveRecord in interface StoreService - Specified by:
retrieveRecord in class Store
- Parameters:
aRecordId - intaContext - com.ibm.dse.base.ContextaFormatName - java.lang.String
- Throws:
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSESQLException - if an SQLException is caught
java.io.IOException - if there is an error instanciating the formatter from its
external definition
retrieveRecord
public Hashtable retrieveRecord(java.lang.String aSelectionCriteria)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves the first record of the store table that matches the selection
criteria.
- Specified by:
retrieveRecord in interface StoreService - Specified by:
retrieveRecord in class Store
- Parameters:
aSelectionCriteria - java.lang.String - the selection criteria in SQL format
- Returns:
- Hashtable - the Hashtable containing the record columns values
- Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveRecord
public int retrieveRecord(java.lang.String aSelectionCriteria,
Context aContext,
HashtableFormat aHashtableFormat)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves the first record of the store table that matches the selection
criteria and returns its recordId. The method, after calling the method
retrieveRecord(String) with the selection criteria argument, calls the
unformat method of the aHashtableFormat formatter and passes the aContext
as an argument. The aContext is automatically updated with the retrieved
record columns values.
- Specified by:
retrieveRecord in interface StoreService - Specified by:
retrieveRecord in class Store
- Parameters:
aContext - com.ibm.dse.base.ContextaSelectionCriteria - java.lang.StringaContext - com.ibm.dse.base.ContextaHashtableFormat - com.ibm.dse.base.HashtableFormat
- Returns:
- int - the recordId of the retrieved record
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveRecord
public int retrieveRecord(java.lang.String aSelectionCriteria,
Context aContext,
HashtableFormat aHashtableFormat,
Vector aColumnsVector)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves the columns in aColumnsVector of the first record of the store
table that matches the selection criteria and returns its recordId. The
method, after calling the method retrieveRecord(String) with the
selection criteria argument, calls the unformat method of the
aHashtableFormat formatter and passes the aContext as an argument. The
aContext is automatically updated with the retrieved record columns
values.
- Parameters:
aContext - com.ibm.dse.base.ContextaSelectionCriteria - java.lang.StringaContext - com.ibm.dse.base.ContextaHashtableFormat - com.ibm.dse.base.HashtableFormataColumnsVector - com.ibm.dse.base.Vector, the vector that contains the columns
to be retrieved
- Returns:
- int - the recordId of the retrieved record
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveRecord
public int retrieveRecord(java.lang.String aSelectionCriteria,
Context aContext,
java.lang.String aFormatName)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSEInvalidRequestException,
DSESQLException,
java.io.IOException
- Retrieves the first record of the store table that matches the selection
criteria and returns its recordId. The method, after calling the method
retrieveRecord(String) with the selection criteria argument, calls the
unformat method of the aFormatName formatter and passes the aContext as
an argument. The aContext is automatically updated with the retrieved
record columns values.
- Specified by:
retrieveRecord in interface StoreService - Specified by:
retrieveRecord in class Store
- Parameters:
aSelectionCriteria - java.lang.StringaContext - com.ibm.dse.base.ContextaFormatName - java.lang.String
- Returns:
- int - the recordId of the retrieved record
- Throws:
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSESQLException - if an SQLException is caught
java.io.IOException - if there is an error instanciating the formatter from its
external definition
retrieveRecord
public int retrieveRecord(java.lang.String aSelectionCriteria,
Context aContext,
java.lang.String aFormatName,
Vector aColumnsVector)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSEInvalidRequestException,
DSESQLException,
java.io.IOException
- Retrieves the columns in aColumnsVector of the first record of the store
table that matches the selection criteria and returns its recordId. The
method, after calling the method retrieveRecord(String) with the
selection criteria argument, calls the unformat method of the aFormatName
formatter and passes the aContext as an argument. The aContext is
automatically updated with the retrieved record columns values.
- Parameters:
aSelectionCriteria - java.lang.StringaContext - com.ibm.dse.base.ContextaFormatName - java.lang.StringaColumnsVector - com.ibm.dse.base.Vector, the vector that contains the columns
to be retrieved
- Returns:
- int - the recordId of the retrieved record
- Throws:
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSESQLException - if an SQL Exception is caught
java.io.IOException - if there is an error instanciating the formatter from its
external definition
retrieveRecord
public Hashtable retrieveRecord(java.lang.String aSelectionCriteria,
Vector aColumnsVector)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves the columns in aColumnsVector of the first record of the store
table that matches the selection criteria.
- Parameters:
aSelectionCriteria - java.lang.String - the selection criteria in SQL formataColumnsVector - com.ibm.dse.base.Vector - the vector that contains the columns
to be retrieved
- Returns:
- Hashtable - the Hashtable containing the record columns values
- Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveRecordForForwarding
public Hashtable retrieveRecordForForwarding(int aRecordId)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves a record of the store table with an specific recordId and marks
it as retrievedForForwarding.
- Parameters:
aRecordId - int - the record Identifier
- Returns:
- Hashtable - the Hashtable containing the record columns values
- Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveRecordForForwarding
public void retrieveRecordForForwarding(int aRecordId,
Context aContext,
HashtableFormat aHashtableFormat)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves a record of the store table with an specific recordId and marks
it as retrievedForForwarding. The retrieved record is unformated into
aContext using aHashtableFormat
- Parameters:
aContext - com.ibm.dse.base.ContextaSelectionCriteria - java.lang.StringaContext - com.ibm.dse.base.ContextaHashtableFormat - com.ibm.dse.base.HashtableFormat
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveRecordForForwarding
public void retrieveRecordForForwarding(int aRecordId,
Context aContext,
java.lang.String aFormatName)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSEInvalidRequestException,
DSESQLException,
java.io.IOException
- Retrieves a record of the store table with an specific recordId and marks
it as retrievedForForwarding. The retrieved record is unformated into
aContext using a formatter named aFormatName.
- Parameters:
aRecordId - intaContext - com.ibm.dse.base.ContextaFormatName - java.lang.String
- Throws:
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSESQLException - if an SQLException is caught
java.io.IOException - if there is an error instanciating the formatter from its
external definition
retrieveRecordForForwarding
public Hashtable retrieveRecordForForwarding(java.lang.String aSelectionCriteria)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves the first record of the store table that matches the selection
criteria and marks it as retrievedForForwarding.
- Parameters:
aSelectionCriteria - java.lang.String - the selection criteria in SQL format
- Returns:
- Hashtable - the Hashtable containing the record columns values
- Throws:
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveRecordForForwarding
public int retrieveRecordForForwarding(java.lang.String aSelectionCriteria,
Context aContext,
HashtableFormat aHashtableFormat)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves the first record of the store table that matches the selection
criteria and marks it as retrievedForForwarding. The method returns the
recordId of the record retrieved. The retrieved record is unformated into
aContext using aHashtableFormat.
- Parameters:
aContext - com.ibm.dse.base.ContextaSelectionCriteria - java.lang.StringaContext - com.ibm.dse.base.ContextaHashtableFormat - com.ibm.dse.base.HashtableFormat
- Returns:
- int the recordId
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveRecordForForwarding
public int retrieveRecordForForwarding(java.lang.String aSelectionCriteria,
Context aContext,
java.lang.String aFormatName)
throws DSEInternalErrorException,
DSEInvalidArgumentException,
DSEInvalidRequestException,
DSESQLException,
java.io.IOException
- Retrieves the first record of the store table that matches the selection
criteria and marks it as retrievedForForwarding. The method returns the
recordId of the record retrieved. The retrieved record is unformated into
aContext using a formatter named aFormatName.
- Parameters:
aSelectionCriteria - java.lang.StringaContext - com.ibm.dse.base.ContextaFormatName - java.lang.String
- Returns:
- int the recordId
- Throws:
DSEInternalErrorException - if an internal program error occurs
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSESQLException - if an SQLException is caught
java.io.IOException - if there is an error instanciating the formatter from its
external definition
retrieveRecordsForForwarding
public Vector retrieveRecordsForForwarding(java.lang.String aSearchCondition)
throws DSEInternalErrorException,
DSEInvalidRequestException,
DSEInvalidArgumentException,
DSESQLException
- Retrieves all the records from the store table that match
aSearchCondition.
- Specified by:
retrieveRecordsForForwarding in interface StoreService - Specified by:
retrieveRecordsForForwarding in class Store
- Parameters:
aSearchCondition - java.lang.String the search condition in SQL format
- Returns:
- com.ibm.dse.base.Vector
- Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
retrieveRecordsForForwarding
public void retrieveRecordsForForwarding(java.lang.String aSearchCondition,
Context aContext,
HashtableIndexedCollectionFormat anOutputFormat)
throws DSEInternalErrorException,
DSEInvalidRequestException,
DSEInvalidArgumentException,
DSESQLException,
DSEObjectNotFoundException,
java.io.IOException
- Retrieves all the records from the store table that match
aSearchCondition. The retrieved records are then unformatted into the
aContext using anOutputFormat.
- Specified by:
retrieveRecordsForForwarding in interface StoreService - Specified by:
retrieveRecordsForForwarding in class Store
- Parameters:
aSearchCondition - java.lang.String - the search condition in SQL formataContext - com.ibm.dse.base.Context - the context into which the
retrieved records will be unformattedanOutputFormat - com.ibm.dse.base.HashtableIndexedCollectionFormat - the
formatter to unformat the retrieved records
- Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSESObjectNotFoundException - if an object is not found
java.io.IOException - if there is an error instanciating the formatter from its
external definition
DSEObjectNotFoundException
retrieveRecordsForForwarding
public void retrieveRecordsForForwarding(java.lang.String aSearchCondition,
Context aContext,
java.lang.String anOutputFormatName)
throws DSEInternalErrorException,
DSEInvalidRequestException,
DSEInvalidArgumentException,
DSESQLException,
DSEObjectNotFoundException,
java.io.IOException
- Retrieves all the records from the store table that match
aSearchCondition. The retrieved records are then unformatted into the
context aContext using the format named anOutputFormatName.
- Specified by:
retrieveRecordsForForwarding in interface StoreService - Specified by:
retrieveRecordsForForwarding in class Store
- Parameters:
aSearchCondition - java.lang.String - the search condition in SQL formataContext - com.ibm.dse.base.Context - the context into which the
retrieved records will be unformattedanOutputFormatName - java.lang.String - the name of the formatter to unformat the
retrieved records
- Throws:
DSEInvalidRequestException - if the request is not valid
DSEInvalidArgumentException - if the argument(s) is(are) not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSESObjectNotFoundException - if an object is not found
java.io.IOException - if there is an error instanciating the formatter from its
external definition
DSEObjectNotFoundException
rollback
public void rollback()
throws DSESQLException
- Rolls back all Database changes.
- Specified by:
rollback in interface StoreService - Specified by:
rollback in class Store
- Throws:
DSESQLException - when rollback fails
setCatalogName
public void setCatalogName(java.lang.String newCatalogName)
- Sets the catalog attribute to the string provided as an argument.
- Parameters:
s - java.lang.String
setColumnsTable
protected void setColumnsTable(Hashtable aColumnsHashtable)
- Sets the columnsHashtable attribute value of this Db2Store instance to
aColumnsHashtable. The columns Hashtable has the following format:
key=column_name, value=data_field_name
- Parameters:
aColumnsHashtable - Hashtable
setJDBCDriver
public void setJDBCDriver(java.lang.String newJDBCDriver)
- Sets the JDBCDriver attribute value to newJDBCDriver.
- Parameters:
newJDBCDriver - java.lang.String
setLastRecordNumber
protected void setLastRecordNumber(int aRecordNumber)
- Sets the lastRecordNumber attribute value of this Db2Store instance to
aRecordNumber.
- Parameters:
aRecordNumber - int, the number of the last record inserted in the store table
setSchemaName
public void setSchemaName(java.lang.String s)
- Sets the schema attribute to the string provided as an argument.
- Parameters:
s - java.lang.String
toStrings
public Vector toStrings()
- Used by the externalizer when a new store service instance is requested
by the application.
- Overrides:
toStrings in class Service
- Returns:
- com.ibm.dse.base.Vector
updateRecord
public int updateRecord(int aRecordId,
Context aContext,
HashtableFormat aHashtableFormat)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException,
DSEInvalidClassException
- Updates the store table record that has the aRecordId identifier with the
data obtained by formatting the aContext with the aHashtableFormat.
- Specified by:
updateRecord in interface StoreService - Specified by:
updateRecord in class Store
- Parameters:
aRecordId - intaContext - com.ibm.dse.base.ContextaHashtableFormat - com.ibm.dse.base.HashtableFormat
- Returns:
- int - the row count ( number of updated records)
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidClassException - if there is an error in the formatting process
updateRecord
public int updateRecord(int aRecordId,
Context aContext,
HashtableFormat aHashtableFormat,
Vector aColumnsVector)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException,
DSEInvalidClassException
- Updates the columns in aColumnsVector for the store table record that has
the aRecordId identifier with the data obtained by formatting the
aContext using the aHashtableFormat. It calls the method
updateRecord(int,Hashtable,Vector).
- Parameters:
aRecordId - intaContext - com.ibm.dse.base.ContextaHashtableFormat - com.ibm.dse.base.HashtableFormataColumnsVector - com.ibm.dse.base.Vector - the columns to be changed
- Returns:
- int - the row count ( number of updated records)
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidClassException - if there is an error in the formatting process
updateRecord
public int updateRecord(int aRecordId,
Context aContext,
java.lang.String aFormatName)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException,
DSEInvalidClassException,
java.io.IOException
- Updates the store table record that has the aRecordId identifier with the
data obtained by formatting the aContext with the formatter identified by
aFormatName.
- Specified by:
updateRecord in interface StoreService - Specified by:
updateRecord in class Store
- Parameters:
aRecordId - intaContext - com.ibm.dse.base.ContextaFormatName - String - the name of the formatter to be used
- Returns:
- int - the row count ( number of updated records)
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidClassException - if there is an error in the formatting process
java.io.IOException - if there is an error instanciating the formatter from its
external definition
updateRecord
public int updateRecord(int aRecordId,
Context aContext,
java.lang.String aFormatName,
Vector aColumnsVector)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException,
DSEInvalidClassException,
java.io.IOException
- Updates the columns in aColumnsVector for the store table record that has
the aRecordId identifier with the data obtained by formatting the
aContext using the formatter identified by aFormatName. It calls the
method updateRecord(int, Hashtable, Vector).
- Parameters:
aRecordId - intaContext - com.ibm.dse.base.ContextaFormatName - String - the name of the formatter to be usedaColumnsVector - com.ibm.dse.base.Vector - the columns to be updated
- Returns:
- int - the row count ( number of updated records)
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
DSEInvalidClassException - if there is an error in the formatting process
java.io.IOException - if there is an error instanciating the formatter from its
external definition
updateRecord
public int updateRecord(int aRecordId,
Hashtable aDataHashtable)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Updates the store table record that has the aRecordId identifier with the
data in aDataHashtable.
- Specified by:
updateRecord in interface StoreService - Specified by:
updateRecord in class Store
- Parameters:
aRecordId - intaDataHashtable - com.ibm.dse.base.Hashtable - the hashtable that contains the
new data
- Returns:
- int - the row count ( number of updated records)
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
updateRecord
public int updateRecord(int aRecordId,
Hashtable aDataHashtable,
Vector aColumnsVector)
throws DSEInvalidRequestException,
DSEInternalErrorException,
DSEInvalidArgumentException,
DSESQLException
- Updates the columns in aColumnVector for the store table record that has
the aRecordId identifier with the data in aDataHashtable.
- Parameters:
aRecordId - intaDataHashtable - com.ibm.dse.base.Hashtable - the hashtable that contains the
new dataaColumnsVector - com.ibm.dse.base.Vector - the columns to be updated
- Returns:
- int - the row count ( number of updated records)
- Throws:
DSEInvalidArgumentException - if an argument is not valid
DSEInvalidRequestException - if the input parameters are not valid
DSEInternalErrorException - if an internal program error occurs
DSESQLException - if an SQLException is caught
(c) Copyright IBM Corporation 1998, 2009
|