Package com.softwaremining.sql
Interface ISQLWrapper
- All Superinterfaces:
IPersistence
,ISMBean
- All Known Implementing Classes:
AbstractIndexedFile
,AbstractORContainer
,CachedSQLWrapper
,CAIdealWrapper
,CicsIndexedFile
,CicsPersistence
,Db400
,Db400Container
,Db400Sequential
,DBMSWrapper
,DMSWrapper
,IDS2Wrapper
,ImsDbSegment
,LinkedSQLWrapper
,QueueRecord
,SQLWrapper
,TSQueueStorageImpl
Interface for Object-Relational classes talking to a database
-
Field Summary
Fields inherited from interface com.softwaremining.sql.IPersistence
ACCESS_MODE_DYNAMIC, ACCESS_MODE_RANDOM, ACCESS_MODE_SEQUENTIAL, ASCENDING_RECORD_KEY, CONDITION_TYPE_EQUALS, CONDITION_TYPE_GREATER, CONDITION_TYPE_GREATER_OR_EQUALS, CONDITION_TYPE_IGNORE, CONDITION_TYPE_IGNORE_FOR_SQL_LIKE, CONDITION_TYPE_LESS, CONDITION_TYPE_LESS_OR_EQUALS, CONDITION_TYPE_LIKE, CONDITION_TYPE_NO_CONDITION, CONDITION_TYPE_NOT_ASSIGNED, DESCENDING_RECORD_KEY, OPEN_MODE_EXTEND, OPEN_MODE_I_O, OPEN_MODE_INPUT, OPEN_MODE_NOT_OPENED, OPEN_MODE_OUTPUT, STATUS_AT_END, STATUS_DUP_KEY, STATUS_FAILED_CLOSING, STATUS_INCORRECT_READ_OF_UNOPENED_FILE, STATUS_INCORRECT_RECORDSIZE_REWRITE, STATUS_INSERT_ERR_INAPPROPRIATE_FILE, STATUS_INSERT_ERR_INVALID_KEY, STATUS_LOCK, STATUS_NOT_FOUND, STATUS_REWRITE_WITHOUT_READ, STATUS_SM_FAIL_UNKOWN_REASON, STATUS_SM_NOT_ASSIGNED, STATUS_SUCCESS, UNCERTAIN_OF_RETURN_VALUE
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assignAccessMode
(int accessMode) void
assignAdditionalSQLConditions
(String condition) This method allows inserting additional conditions - e.g.void
assignAdditionalSQLConditions
(StringBuilder condition) This method allows inserting additional conditions - e.g.void
assignAdditionalSQLOrderBy
(String newValue) This method allows inserting additional Ordering clauses It is useful in hierarchical tables will define additional SQLConditions - e.g.void
assignCachedSeekValues
(List objects) void
assignChangeGEConditonToLIKE
(boolean newValue) The system can replace GE searches to LIKE statements.void
assignChangeGTEQ2EQForLIKECondition
(boolean useEQForExactLenghtMatch) Only applies when OR_CHANGE_GE_CONDITION_TO_LIKE__DEFAULT=true
E.g.void
assignConnection
(Connection connection) void
assignDbDecorator
(ACMDbDecorator dbDecorator) void
assignDelegateDAO
(ISQLWrapper delegateDAO) void
assignExpandGTEQSearches
(boolean expandGTEQSearches) (default is true) Example: Lets say there are 3 key fields involved in a search with condition GTEQ
If flag is set to true (default) - then the following SQL condition will be generated
(A > ? or (A = ? and B > ?) or (A = ? and B = ? and C >= ?))
With flag is set to FALSE - the following will be generated
(A >= ?) and (B >= ?) and (C >= ?)void
assignFetchDirectionIsForward
(Boolean direction) void
assignFileOpened
(boolean fileOpened) void
assignGDGCondition
(String gdgCondition) Additional SQL statement to be read from gdg.properties file.void
assignGDGProperty
(String gdgProperty) Additional SQL statement to be read from gdg.properties file.void
assignGenerate_OrderBy_ForReadStatements
(boolean enabled) READ() statement on DB tables with MANY rows, issues an ORDER BY on the SELECT which may have a big performance impact.void
assignIgnoreOriginalKeys
(boolean newValue) for internal usevoid
assignKeyIsUnique
(boolean keyUnique) void
Used only used by CicsPersistent Subclasses.void
assignLastSeekCondition
(int lastSeekCondition) void
assignLastSeekConditionLookedForEquality
(boolean newValue) void
assignLowerLimitForExpandGTEQSearches
(int range) (default is -1 - disabled) Only works when assignExpandGTEQSearches(true);
Example: Lets say there are 3 key fields involved in a search with condition GTEQ
In default settings, the following SQL condition will be generatedvoid
assignOpenMode
(int openMode) void
assignRecordKey
(ISMObject recordKey) Used only used by CicsPersistent Subclasses.void
assignRecordKey
(ISMObject[] recordKeys) Used only used by CicsPersistent Subclasses.void
assignResultSet
(ResultSet resultSet) void
assignResultSetFetchSize
(int newFetchSize) void
assignRowFacade
(RowFacade rowFacade) void
assignSequentialKeyGeneration
(boolean sequentialKeyGeneration) void
assignSQLConditions
(String condition)
Ignore the inbuilt KEY (defined by assignRecordKey(...)) - and use this condition instead
Please note program will be responsible for passing additional parameters.void
assignSQLTableName
(String newName) Change the underlying SQL table-name FROM persistent-Classesvoid
assignStatus
(ISMObject status) void
assignStatusValue
(int newValue) void
assignSuppressSeek
(boolean newValue) for internal use only - For VSAM SEEK / READ / ...void
assignTableName
(String newName) Change the underlying SQL table-name FROM PROGRAMSvoid
assignThrowInvalidKeyException
(boolean newValue) for internal use only - For VSAM SEEK / READ / ...void
assignTopRowSelectStrategyCount
(int count) (Default = -1) When set to 0 or 1 , the Object-Relation SQL Generator will produce:void
assignTopRowSelectStrategyRange
(int startRowNumber, int count) Similar to assignTopRowSelectStrategyCount - but aslso defines starting pointsvoid
assignTreatAsSQLWrapper
(boolean treatAsSQLWrapper) Used only used by CicsPersistent Subclasses.void
assignUpperLimitForExpandGTEQSearches
(int range) (default is -1 - disabled) Only works when assignExpandGTEQSearches(true);
Example: Lets say there are 3 key fields involved in a search with condition GTEQ
In default settings, the following SQL condition will be generatedint
close()
int
delete()
int
insert()
boolean
internal use only.boolean
The system can replace GE searches to LIKE statements.boolean
For internal Use only.boolean
boolean
boolean
boolean
boolean
isKept()
boolean
boolean
boolean
used in AS400 / DB400 to increase speed of searchesboolean
for internal use only - For VSAM SEEK / READ / ...boolean
boolean
int
next()
int
prev()
int
read()
void
reduceGEorEQ
(boolean newValue) used in AS400 / DB400 to increase speed of searchesint
int
int
assignSQLCondition can also have conditions such as "NAME = ?".boolean
for internal usefor internal use onlyint
int
Used only used by CicsPersistent Subclasses.int
For internal use onlyint
boolean
for internal use only - For VSAM SEEK / READ / ...int
For internal use only (Default = -1) When set to 0 or 1 , the Object-Relation SQL Generator will produce:int
for internal use onlyint
seekRecord
(ISMObject[] keys, int conditionType) int
seekRecord
(ISMObject key, int conditionType) void
setLock
(boolean newValue) void
unlock()
int
update()
boolean
int
validateConditionType
(ISMObject key, int conditionType) For internal use only reverts to defaults for CONDITION_TYPE_NO_CONDITION and CONDITION_TYPE_NOT_ASSIGNEDMethods inherited from interface com.softwaremining.wrappers.ISMBean
assignExemptFromMemRelease, assignSessionId, assignValue, initialize, isExemptFromMemRelease, isResourceAlreadyReleased, releaseResources, resetStructure, retrieveActualLength, retrieveAsString, retrieveField, retrieveField, retrieveTopLevelField, retrieveValue, stringValue
-
Method Details
-
retrieveStatusValue
int retrieveStatusValue() -
retrieveNativeKeys
ISMObject[] retrieveNativeKeys() -
retrieveAdditionalSQLOrderBy
StringBuilder retrieveAdditionalSQLOrderBy() -
retrieveAdditionalSQLCondition
StringBuilder retrieveAdditionalSQLCondition() -
assignResultSet
-
retrieveResultSet
ResultSet retrieveResultSet() -
assignStatusValue
void assignStatusValue(int newValue) -
isKept
boolean isKept() -
setLock
void setLock(boolean newValue) -
unlock
void unlock() -
useOidTableForKeyGeneration
boolean useOidTableForKeyGeneration() -
assignDelegateDAO
-
retrieveDelegateDAO
ISQLWrapper retrieveDelegateDAO() -
retrieveConnection
Connection retrieveConnection() -
assignConnection
-
assignFetchDirectionIsForward
-
isFetchDirectionForward
boolean isFetchDirectionForward() -
isFetchDirectionBackward
boolean isFetchDirectionBackward() -
validateConditionType
For internal use only reverts to defaults for CONDITION_TYPE_NO_CONDITION and CONDITION_TYPE_NOT_ASSIGNED- Parameters:
conditionType
-- Returns:
-
retrieveImplicitDatabaseKey
ISMObject retrieveImplicitDatabaseKey()for internal use only- Returns:
-
assignRecordKey
Used only used by CicsPersistent Subclasses. -
assignRecordKey
Used only used by CicsPersistent Subclasses. -
assignTreatAsSQLWrapper
void assignTreatAsSQLWrapper(boolean treatAsSQLWrapper) Used only used by CicsPersistent Subclasses. allows CicsPersistent (ILE or other subclasses of this) to be treated as SQLWrapper (Object-relational VSAM Files) by batch programs. -
close
- Throws:
IOCriticalException
-
assignAdditionalSQLOrderBy
This method allows inserting additional Ordering clauses It is useful in hierarchical tables will define additional SQLConditions - e.g. (INDX_FLD_TABLE_1 ASCENDING)- Parameters:
condition
-
-
assignSQLConditions
Ignore the inbuilt KEY (defined by assignRecordKey(...)) - and use this condition instead
Please note program will be responsible for passing additional parameters.
e.g. assignSQLConditions("NAME = 'SMITH");
(or when assignSQLConditions("NAME = ?") - the program should also use the "addSearchParameter" method to provide values- Parameters:
condition
-
-
assignAdditionalSQLConditions
This method allows inserting additional conditions - e.g. assignAdditionalSQLConditions( "(COLUMN_2 = 12)"); It is useful in hierarchical tables will define additional SQLConditions - e.g. (INDX_FLD_TABLE_1 = 12), as well as GDG support- Parameters:
condition
-
-
assignAdditionalSQLConditions
This method allows inserting additional conditions - e.g. assignAdditionalSQLConditions( "(COLUMN_2 = 12)"); It is useful in hierarchical tables will define additional SQLConditions - e.g. (INDX_FLD_TABLE_1 = 12), as well as GDG support- Parameters:
condition
-
-
retrieveAdditionalSearchParameters
assignSQLCondition can also have conditions such as "NAME = ?". In that case the program should also use the "addSearchParameter" method to provide values- Returns:
-
assignTableName
Change the underlying SQL table-name FROM PROGRAMS- Parameters:
newName
-
-
assignSQLTableName
Change the underlying SQL table-name FROM persistent-Classes- Parameters:
newName
-
-
retrieveTableName
String retrieveTableName() -
assignResultSetFetchSize
void assignResultSetFetchSize(int newFetchSize) -
next
int next() -
prev
int prev() -
read
int read() -
insert
int insert() -
delete
int delete() -
update
int update() -
retrieveAscentDescendOrder
-
retrieveResultSetFetchSize
int retrieveResultSetFetchSize() -
isFileOpened
boolean isFileOpened() -
assignFileOpened
void assignFileOpened(boolean fileOpened) -
assignStatus
-
retrieveAccessMode
int retrieveAccessMode() -
assignAccessMode
void assignAccessMode(int accessMode) -
retrieveSessionId
Long retrieveSessionId()Description copied from interface:ISMBean
For internal use only- Specified by:
retrieveSessionId
in interfaceISMBean
-
retrieveRowFacade
RowFacade retrieveRowFacade() -
assignRowFacade
-
retrieveDbDecorator
ACMDbDecorator retrieveDbDecorator() -
assignDbDecorator
-
retrieveLastSeekCondition
int retrieveLastSeekCondition() -
assignLastSeekCondition
void assignLastSeekCondition(int lastSeekCondition) -
assignOpenMode
void assignOpenMode(int openMode) -
retrieveOpenMode
int retrieveOpenMode() -
isSequentialKeyGeneration
boolean isSequentialKeyGeneration() -
assignSequentialKeyGeneration
void assignSequentialKeyGeneration(boolean sequentialKeyGeneration) -
assignLastSeekConditionLookedForEquality
void assignLastSeekConditionLookedForEquality(boolean newValue) -
isLastSeekConditionLookedForEquality
boolean isLastSeekConditionLookedForEquality() -
isKeyUnique
boolean isKeyUnique() -
assignKeyIsUnique
void assignKeyIsUnique(boolean keyUnique) -
isSuppressNextReadCurrent
boolean isSuppressNextReadCurrent() -
retrieveFileName
String retrieveFileName() -
reduceGEorEQ
void reduceGEorEQ(boolean newValue) used in AS400 / DB400 to increase speed of searches -
isReduceGEorEQ
boolean isReduceGEorEQ()used in AS400 / DB400 to increase speed of searches -
isAllowedToExpandGTEQSearches
boolean isAllowedToExpandGTEQSearches()internal use only. Example: Lets say there are 3 key fields involved in a search with condition GTEQ
If flag is set to true (default) - then the following SQL condition will be generated
(A > ? or (A = ? and B > ?) or (A = ? and B = ? and C >= ?))
With flag is set to FALSE - the following will be generated
(A >= ?) and (B >= ?) and (C >= ?)- Parameters:
newValue
-
-
assignExpandGTEQSearches
void assignExpandGTEQSearches(boolean expandGTEQSearches) (default is true) Example: Lets say there are 3 key fields involved in a search with condition GTEQ
If flag is set to true (default) - then the following SQL condition will be generated
(A > ? or (A = ? and B > ?) or (A = ? and B = ? and C >= ?))
With flag is set to FALSE - the following will be generated
(A >= ?) and (B >= ?) and (C >= ?)- Parameters:
newValue
-
-
assignLowerLimitForExpandGTEQSearches
void assignLowerLimitForExpandGTEQSearches(int range) (default is -1 - disabled) Only works when assignExpandGTEQSearches(true);
Example: Lets say there are 3 key fields involved in a search with condition GTEQ
In default settings, the following SQL condition will be generatedSELECT ... FROM ... WHERE (A > ?) or (A = ? and B > ?) or (A = ? and B = ? and C >= ?))
using the statement assignLowerLimitForExpandGTEQSearches( 3 ) - the key conditions below position 3 are ignored, and only the following is generated.SELECT ... FROM ... WHERE (A = ? and B = ? and C >= ?))
and the following proceeding conditions are ignored invalid input: '<'> (A > ?)
or (A = ? and B > ?) -
retreiveLowerLimitForExpandGTEQSearches
int retreiveLowerLimitForExpandGTEQSearches() -
assignUpperLimitForExpandGTEQSearches
void assignUpperLimitForExpandGTEQSearches(int range) (default is -1 - disabled) Only works when assignExpandGTEQSearches(true);
Example: Lets say there are 3 key fields involved in a search with condition GTEQ
In default settings, the following SQL condition will be generatedSELECT ... FROM ... WHERE (A > ?) or (A = ? and B > ?) or (A = ? and B = ? and C >= ?))
but if assignUpperLimitForExpandGTEQSearches( 1 ) - only conditions up to 1st Key will be generated
ie The following will be generatedSELECT ... FROM ... WHERE (A > ?)
and the following conditions will NOT be generated (A = ? and B > ?) or (A = ? and B = ? and C >= ?)) -
retreiveUpperLimitForExpandGTEQSearches
int retreiveUpperLimitForExpandGTEQSearches() -
isChangeGEConditonToLIKE
boolean isChangeGEConditonToLIKE()The system can replace GE searches to LIKE statements. this can potentially have a huge performance improvement.
E.g. Consider generating SELECT ... from TABLE WHERE KEY_1 >= ? AND KEY_2 >= ?.
If each key is 5 chars, and the supplied values are "A " and "B " - the above translates to:SELECT ... from TABLE WHERE KEY_1 >= 'A ' AND KEY_2 >= 'B '.
Converting it to LIKE will becomeSELECT ... from TABLE WHERE KEY_1 LIKE 'A%' AND KEY_2 LIKE 'B%'
This makes a significant performance improvements. -
assignChangeGEConditonToLIKE
void assignChangeGEConditonToLIKE(boolean newValue) The system can replace GE searches to LIKE statements. this can potentially have a huge performance improvement.
E.g. Consider generating SELECT ... from TABLE WHERE KEY_1 >= ? AND KEY_2 >= ?.
If each key is 5 chars, and the supplied values are "A " and "B " - the above translates to:SELECT ... from TABLE WHERE KEY_1 >= 'A ' AND KEY_2 >= 'B '.
Converting it to LIKE will becomeSELECT ... from TABLE WHERE KEY_1 LIKE 'A%' AND KEY_2 LIKE 'B%'
This makes a significant performance improvements. -
isChangeGTEQ2EQForLIKECondition
boolean isChangeGTEQ2EQForLIKECondition()For internal Use only.
Only applies when OR_CHANGE_GE_CONDITION_TO_LIKE__DEFAULT=true
E.g. Consider generating SELECT ... from TABLE WHERE KEY_1 >= ? AND KEY_2 >= ?.
If each key is 5 chars, and the supplied values are "ABCDE" and "B " - the above translates to:SELECT ... from TABLE WHERE KEY_1 >= 'ABCDE' AND KEY_2 >= 'B '.
Converting it to LIKE will becomeSELECT ... from TABLE WHERE KEY_1 >= 'ABCDE' AND KEY_2 LIKE 'B%'
When this flag is set, if the char-count of a field is equal to that of the supplied value, then the generated SQL will becomeSELECT ... from TABLE WHERE KEY_1 = 'ABCDE' AND KEY_2 LIKE 'B%'
This can make a significant improvement to performance . -
assignChangeGTEQ2EQForLIKECondition
void assignChangeGTEQ2EQForLIKECondition(boolean useEQForExactLenghtMatch) Only applies when OR_CHANGE_GE_CONDITION_TO_LIKE__DEFAULT=true
E.g. Consider generating SELECT ... from TABLE WHERE KEY_1 >= ? AND KEY_2 >= ?.
If each key is 5 chars, and the supplied values are "ABCDE" and "B " - the above translates to:SELECT ... from TABLE WHERE KEY_1 >= 'ABCDE' AND KEY_2 >= 'B '.
Converting it to LIKE will becomeSELECT ... from TABLE WHERE KEY_1 >= 'ABCDE' AND KEY_2 LIKE 'B%'
When this flag is set, if the char-count of a field is equal to that of the supplied value, then the generated SQL will becomeSELECT ... from TABLE WHERE KEY_1 = 'ABCDE' AND KEY_2 LIKE 'B%'
This can make a significant improvement to performance . -
assignTopRowSelectStrategyCount
void assignTopRowSelectStrategyCount(int count) (Default = -1) When set to 0 or 1 , the Object-Relation SQL Generator will produce:SELECT � FROM table WHERE condition-1
When set to greater than 1 - (for Oracle) it will produce:SELECT ... FROM ( SELECT � FROM table WHERE condition-1 ) WHERE ROWNUM <OR_SELECT_TOP_ROW__DEFAULT;
-
retrieveTopRowSelectStrategyCount
int retrieveTopRowSelectStrategyCount()For internal use only (Default = -1) When set to 0 or 1 , the Object-Relation SQL Generator will produce:SELECT ... FROM table WHERE condition-1
When set to greater than 1 - (for Oracle) it will produce:SELECT ... FROM ( SELECT ... FROM table WHERE condition-1 ) WHERE ROWNUM <OR_SELECT_TOP_ROW__DEFAULT;
-
retrieveTopRowSelectStrategyStartingRow
int retrieveTopRowSelectStrategyStartingRow()for internal use only -
assignTopRowSelectStrategyRange
void assignTopRowSelectStrategyRange(int startRowNumber, int count) Similar to assignTopRowSelectStrategyCount - but aslso defines starting points- Parameters:
startRowNumber
-count
-
-
assignGenerate_OrderBy_ForReadStatements
void assignGenerate_OrderBy_ForReadStatements(boolean enabled) READ() statement on DB tables with MANY rows, issues an ORDER BY on the SELECT which may have a big performance impact. If the data was populated sequentially, then the ORDER BY may not be strictly required, and may be removed. -
retrieveGenerate_OrderBy_ForReadStatements
boolean retrieveGenerate_OrderBy_ForReadStatements()for internal use- Parameters:
newValue
-
-
assignIgnoreOriginalKeys
void assignIgnoreOriginalKeys(boolean newValue) for internal use- Parameters:
newValue
-
-
isIgnoreOriginalKeys
boolean isIgnoreOriginalKeys() -
assignCachedSeekValues
-
retrieveCachedSeekValues
List retrieveCachedSeekValues() -
seekRecord
-
seekRecord
- Throws:
IOStatusException
-
assignGDGProperty
Additional SQL statement to be read from gdg.properties file. E.g. assignGDGProperty("GDG1"); If gdg.properties file contains: GDG1=AND GDG_YEAR=2012 Then the above search condition will be appended to any SQL statements issued reading this class -
assignGDGCondition
Additional SQL statement to be read from gdg.properties file. E.g. assignGDGCondition("GDG_YEAR = 2013"); Then the above search condition will be appended to any SQL statements issued reading this class. -
assignKeyValue
Used only used by CicsPersistent Subclasses. After each read or next, it will update the value of the Key with the new values from database- Parameters:
value
-
-
retrieveRecordKeyValue
String retrieveRecordKeyValue()Used only used by CicsPersistent Subclasses.- Parameters:
value
-
-
retrieveRecordKey
ISMObject retrieveRecordKey() -
retrieveThrowInvalidKeyException
boolean retrieveThrowInvalidKeyException()for internal use only - For VSAM SEEK / READ / ... VSAM apps need to throw InvalidKeyException (even if they use CICS delegates), but CICS applications need to throw KeyNotFoundException ,- Returns:
-
assignThrowInvalidKeyException
void assignThrowInvalidKeyException(boolean newValue) for internal use only - For VSAM SEEK / READ / ... VSAM apps need to throw InvalidKeyException (even if they use CICS delegates), but CICS applications need to throw KeyNotFoundException , -
isSeekSuppressed
boolean isSeekSuppressed()for internal use only - For VSAM SEEK / READ / ... VSAM apps need to throw InvalidKeyException (even if they use CICS delegates), but CICS applications need to throw KeyNotFoundException ,- Returns:
-
assignSuppressSeek
void assignSuppressSeek(boolean newValue) for internal use only - For VSAM SEEK / READ / ... VSAM apps need to throw InvalidKeyException (even if they use CICS delegates), but CICS applications need to throw KeyNotFoundException ,
-