Package com.softwaremining.sql
Class LinkedSQLWrapper
java.lang.Object
com.softwaremining.wrappers.CBLBean
com.softwaremining.wrappers.AbstractBasePersistence
com.softwaremining.sql.AbstractIndexedFile
com.softwaremining.sql.SQLWrapper
com.softwaremining.sql.LinkedSQLWrapper
- All Implemented Interfaces:
IPersistence
,ISQLWrapper
,AbstractDataObject
,ICBLBeanNGroup
,ICBLContainer
,IFieldContainer
,ISMBean
,ISMDataType
- Direct Known Subclasses:
DBMSWrapper
,DMSWrapper
,IDS2Wrapper
,ImsDbSegment
Used for Hierarchical tables definitions such as IMS and DMS
E.g. say we have COMPANY<-DEPARTMENT<-EMPLOYEE
Where a COMPANY has many departments, who has many EMPLOYEES
These classes can be linked together, so when we open the first one, the remainder are opened at the right location.
These classes can be linked together, so when we open the first one, the remainder are opened at the right location.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<LinkedSQLWrapper>
protected ISMObject[]
this is an additional key as defined by the system, used as Foreign key by the associatedint
static final int
not used Used for when foreign keys are defined "EXPLICITLY" ...static final int
not used Used for when foreign keys are defined "IMPLICITLY" ...static final int
BULL ids uses this strategy.protected int
Condition type is one of : IPersistence.CONDITION_TYPE_NO_CONDITION = 0; IPersistence.CONDITION_TYPE_EQUALS = 1; IPersistence.CONDITION_TYPE_GREATER = 2; IPersistence.CONDITION_TYPE_LESS = 3; IPersistence.CONDITION_TYPE_GREATER_OR_EQUALS = 4; IPersistence.CONDITION_TYPE_LESS_OR_EQUALS = 5;protected ISMObject[]
protected List<LinkedSQLWrapper>
protected ISMObject[]
Used for when foreign keys are defined "IMPLICITLY" ...protected boolean
Used for when foreign keys are defined "IMPLICITLY" ...Fields inherited from class com.softwaremining.sql.SQLWrapper
connection, nativeKeys, openMode, postFixTableNameToImplicitDatabaseKey, resultSet, sequentialKeyGeneration, suppressNextReadCurrent
Fields inherited from class com.softwaremining.sql.AbstractIndexedFile
delegateDAO
Fields inherited from class com.softwaremining.wrappers.AbstractBasePersistence
fileName, ownerClassName, status
Fields inherited from class com.softwaremining.wrappers.CBLBean
EBCDIC_JIT_PD_SUPPORT_FOR_SEQ_FILES, INDEX_FOR_NON_ARRAY_VERSION_OF_FIELD, INDEX_ZERO, log, tmp_lengthofAssignedValue, totalRuntime_allocate, totalRuntime_calcFieldOffsets, totalRuntime_getMemoryPosition, totalRuntime_setFieldFormatted
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_CLOSE_FILE_FILE_NOT_OPEN, 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_OPEN_FILE_FILE_NOT_FOUND, STATUS_REWRITE_WITHOUT_READ, STATUS_SM_FAIL_UNKOWN_REASON, STATUS_SM_NOT_ASSIGNED, STATUS_SUCCESS, UNCERTAIN_OF_RETURN_VALUE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMasterTable
(LinkedSQLWrapper masterTable) void
addRecordKeyField
(AbstractCBLField indexField) void
addRecordKeyField
(CBLGroup indexGroup) void
assignAccessMode
(int accessMode) Similar to the COBOL ACCESS Modevoid
assignAllowSearchForChildern
(boolean allowSearchForChildern) void
assignForeignKeyReference
(String fKTableName, AbstractCBLField fkField) This says Child has a key to Master which will act as foreign Index.void
assignForeignKeyValues
(ISMObject[] keys, int conditionType) void
assignReadyForNextIMSRead
(boolean readyForNextIMSRead) void
assignRecordKey
(AbstractCBLField recordKey) int
close()
Close the fileint
when operation is Unsuccessful throw Exception (e.g KeyNotFountException).void
findOwner
(LinkedSQLWrapper master) void
int
insert()
Insert a record - populate the values from the existing fieldsboolean
boolean
int
last()
int
void
linkChild
(LinkedSQLWrapper childTable) int
go to nextint
open
(int openMode) open clas, and dependent / linked classesint
go to nextint
go to nextvoid
void
A-(parent-to)->B-(parent-to)->C
then C.retrieveAllMasterTables will return "A and B"protected ISMObject[]
Stub method to be over-written by LinkedSQLWrapper class.A-(parent-to)->B-(parent-to)->C
then C.retrieveMasterTables will return "B"Native Keys refer to either a.int
Go to the record identified by key Condition type is one of : IPersistence.CONDITION_TYPE_NO_CONDITION = 0; IPersistence.CONDITION_TYPE_EQUALS = 1; IPersistence.CONDITION_TYPE_GREATER = 2; IPersistence.CONDITION_TYPE_LESS = 3; IPersistence.CONDITION_TYPE_GREATER_OR_EQUALS = 4; IPersistence.CONDITION_TYPE_LESS_OR_EQUALS = 5;int
Go to the record identified by key Condition type is one of : IPersistence.CONDITION_TYPE_NO_CONDITION = 0; IPersistence.CONDITION_TYPE_EQUALS = 1; IPersistence.CONDITION_TYPE_GREATER = 2; IPersistence.CONDITION_TYPE_LESS = 3; IPersistence.CONDITION_TYPE_GREATER_OR_EQUALS = 4; IPersistence.CONDITION_TYPE_LESS_OR_EQUALS = 5;int
Go to the record identified by key Condition type is one of : IPersistence.CONDITION_TYPE_NO_CONDITION = 0; IPersistence.CONDITION_TYPE_EQUALS = 1; IPersistence.CONDITION_TYPE_GREATER = 2; IPersistence.CONDITION_TYPE_LESS = 3; IPersistence.CONDITION_TYPE_GREATER_OR_EQUALS = 4; IPersistence.CONDITION_TYPE_LESS_OR_EQUALS = 5;protected void
seekChildren
(ISMObject[] keys, int conditionType) equivalant of START record in COBOLvoid
setKeyExcplicity
(int keyExcplicity) protected int
setToOpen
(int openMode) open clas, and dependent / linked classesint
Translation of COBOL REWRITE statementboolean
Stub method to be over-written by LinkedSQLWrapper class.Methods inherited from class com.softwaremining.sql.SQLWrapper
_clear, _close, _commit, _deleteAllRecord, _deleteRecord, _insertRecord, _nextRecord, _open, _prevRecord, _readRecord, _readWithLock, _rollback, _seekRecord, _unlock, _updateRecord, addRecordKey, addSearchParameter, addSearchParameter, assignAdditionalKeyPosition, assignAdditionalSQLConditions, assignAdditionalSQLConditions, assignAdditionalSQLOrderBy, assignAlternateKey, assignCachedSeekValues, assignChangeGEConditonToLIKE, assignChangeGTEQ2EQForLIKECondition, assignConnection, assignDbDecorator, assignExpandGTEQSearches, assignFetchDirectionIsForward, assignFetchSize, assignFileOpened, assignGDGCondition, assignGDGProperty, assignGenerate_OrderBy_ForReadStatements, assignIgnoreOriginalKeys, assignKeyIsUnique, assignKeyValue, assignKeyValue, assignLastSeekCondition, assignLastSeekConditionLookedForEquality, assignLowerLimitForExpandGTEQSearches, assignOpenMode, assignRecordKey, assignRecordKey, assignRecordKeysAllDescending, assignRelativeKey, assignResultSet, assignResultSetFetchSize, assignRowFacade, assignSequentialKeyGeneration, assignSQLConditions, assignSQLTableName, assignSuppressSeek, assignTableName, assignThrowInvalidKeyException, assignTopRowSelectStrategyCount, assignTopRowSelectStrategyRange, assignTreatAsSQLWrapper, assignUpperLimitForExpandGTEQSearches, clearSearchParameter, createAndretrieveSearchParameterInstance, isAllowedToExpandGTEQSearches, isChangeGEConditonToLIKE, isChangeGTEQ2EQForLIKECondition, isFetchDirectionBackward, isFetchDirectionForward, isFileOpened, isIgnoreOriginalKeys, isKept, isKeyUnique, isLastSeekConditionLookedForEquality, isReduceGEorEQ, isSeekSuppressed, isSequentialKeyGeneration, isSuppressNextReadCurrent, readCurrent, reduceGEorEQ, releaseResources, releaseResources, resetRowFacade, restoreResultSet, retreiveLowerLimitForExpandGTEQSearches, retreiveUpperLimitForExpandGTEQSearches, retrieveAdditionalSearchParameters, retrieveAdditionalSQLCondition, retrieveAdditionalSQLOrderBy, retrieveAscentDescendOrder, retrieveCachedSeekValues, retrieveConnection, retrieveDbDecorator, retrieveGenerate_OrderBy_ForReadStatements, retrieveImplicitDatabaseKey, retrieveLastSeekCondition, retrieveOpenMode, retrieveRecordKey, retrieveRecordKeyValue, retrieveResultSet, retrieveResultSetFetchSize, retrieveRowFacade, retrieveTableName, retrieveThrowInvalidKeyException, retrieveTopRowSelectStrategyCount, retrieveTopRowSelectStrategyStartingRow, setLock, setRelativeKey, trimCachedSeekValues, validateConditionType
Methods inherited from class com.softwaremining.sql.AbstractIndexedFile
_assignKeyValue, assignDelegateDAO, assignStatus, clear, commit, delete, deleteAllRecord, insertRecord, next, prev, read, readWithLock, resetCicsDelegate, retrieveDelegateDAO, rollback, seekRecord, seekRecord, seekRecord, unlock, update
Methods inherited from class com.softwaremining.wrappers.AbstractBasePersistence
assignFileName, assignLock, assignStatus, assignStatusAsPrimitive, assignStatusValue, assignStatusValue, readRow, retrieveAccessMode, retrieveFileName, retrieveFileName, retrieveFirstLevelEntry, retrieveSessionId, retrieveStatusField, retrieveStatusValue
Methods inherited from class com.softwaremining.wrappers.CBLBean
addCorrespondingValue, addCorrespondingValue, allocate, assignAddressTo, assignAddressTo, assignBean, assignBytesEncoded, assignCachedInitializationValue, assignCorrespondingValue, assignCorrespondingValue, assignDefaultValue, assignDependingField, assignEbcdicBytes, assignEbcdicJIT_PdSupportForSequentialFiles, assignEncodedValue, assignExemptFromMemRelease, assignExternal, assignHighValues, assignInternalVars, assignLowValues, assignRawEbcdicBytes, assignRecordSize, assignRedefines, assignRedefines, assignSessionId, assignStringFormatted, assignSubstring, assignSubstring, assignToAddressOf, assignToAddressOf, assignToAddressOf, assignToAddressOf, assignToAllFields, assignValue, assignValue, assignValue, assignValue, assignValue, assignValue, assignValue, assignValue, calculateStorageSize, containsPointers, equals, equals, equals, equals, equalsRightTrimmed, fieldsCount, fill, fill, fill, fill, fill, getValue, hasPackedDecimalFields, initDefaultValues, initialize, initialize, isExemptFromMemRelease, isFilled, isFilled, isFilled, isFilled, isGreaterThan, isGreaterThan, isGreaterThan, isHighValues, isInvolvedInDependency, isInvolvedInExternalDependency, isLessOrEqualTo, isLessOrEqualTo, isLessOrEqualTo, isLessOrEqualTo, isLessOrEqualTo, isLessThan, isLessThan, isLessThan, isLessThan, isLessThan, isLowValues, isRedefinedByAnotherClass, isResourceAlreadyReleased, lengthOf, printFieldPosition, printFieldValues, printOrderedFieldPosition, PrintOrderedFieldPositionsAndValue, resetCachedValues, resetCompressedFieldList, resetStructure, resize, retrieveActualLength, retrieveAsInt, retrieveAsString, retrieveCachedInitializationValue, retrieveCompressedFields, retrieveDependedFieldsList, retrieveEbcdicBytes, retrieveEbcdicValue, retrieveEncodedValue, retrieveField, retrieveField, retrieveFieldAtMemoryPosition, retrieveFieldFormatted, retrieveFields, retrieveIsTargetOfPointers, retrievePrimitiveFields, retrieveRawEbcdicBytes, retrieveSQLObject, retrieveStorageBytes, retrieveStorageCellSize, retrieveSubstring, retrieveSubstring, retrieveTopLevelField, retrieveValue, retrieveValue, setValue, stringValue, subtractCorrespondingValue, subtractCorrespondingValue, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.softwaremining.wrappers.ISMBean
assignExemptFromMemRelease, assignSessionId, assignValue, initialize, isExemptFromMemRelease, isResourceAlreadyReleased, resetStructure, retrieveActualLength, retrieveAsString, retrieveField, retrieveField, retrieveTopLevelField, retrieveValue, stringValue
Methods inherited from interface com.softwaremining.sql.ISQLWrapper
assignStatusValue, retrieveAccessMode, retrieveFileName, retrieveSessionId, retrieveStatusValue
-
Field Details
-
latestConditionType
protected int latestConditionTypeCondition type is one of : IPersistence.CONDITION_TYPE_NO_CONDITION = 0; IPersistence.CONDITION_TYPE_EQUALS = 1; IPersistence.CONDITION_TYPE_GREATER = 2; IPersistence.CONDITION_TYPE_LESS = 3; IPersistence.CONDITION_TYPE_GREATER_OR_EQUALS = 4; IPersistence.CONDITION_TYPE_LESS_OR_EQUALS = 5; -
masterKeys
-
childTables
-
masterTables
-
KEYTYPE_IMPLICIT_ON_MASTER_AND_DETAIL
public static final int KEYTYPE_IMPLICIT_ON_MASTER_AND_DETAILBULL ids uses this strategy. It means MASTER table has a hidden key, and the foreign-key definition on DETAIL table uses a (hidden) reference to this key- See Also:
-
KEYTYPE_EXPLICIT_ON_MASTER_ONLY
public static final int KEYTYPE_EXPLICIT_ON_MASTER_ONLYnot used Used for when foreign keys are defined "IMPLICITLY" ... We have not seen any dialects of Cobol which implements this strategy, however, we built the link-tables this way ... so lets keep the functionality and see whether any dialect uses this. PS ... for testing purposes, please see com.softwaremining.tests.linkedtables- See Also:
-
KEYTYPE_EXPLICIT_ON_MASTER_AND_DETAIL
public static final int KEYTYPE_EXPLICIT_ON_MASTER_AND_DETAILnot used Used for when foreign keys are defined "EXPLICITLY" ... The first version of IDS processing was (incorrectly) using this strategy We have not seen any dialects of Cobol which implements this strategy, however, we built the link-tables this way ... so lets keep the functionality and see whether any dialect uses this. PS ... for testing purposes, please see com.softwaremining.tests.linkedtables- See Also:
-
keyExcplicity
public int keyExcplicity -
usesExplicitForeignkeyOnMaster
protected boolean usesExplicitForeignkeyOnMasterUsed for when foreign keys are defined "IMPLICITLY" ... We have not seen any dialects of Cobol which implements this strategy, however, we built the link-tables this way ... so lets keep the functionality PS ... for testing purposes, please see com.softwaremining.tests.linkedtables -
nativeAndImplicitMasterKeys
Used for when foreign keys are defined "IMPLICITLY" ... We have not seen any dialects of Cobol which implements this strategy, however, we built the link-tables this way ... so lets keep the functionality PS ... for testing purposes, please see com.softwaremining.tests.linkedtables -
foreignKeys
this is an additional key as defined by the system, used as Foreign key by the associated
-
-
Constructor Details
-
LinkedSQLWrapper
default constructor- Parameters:
owner
-
-
-
Method Details
-
linkChild
-
setKeyExcplicity
public void setKeyExcplicity(int keyExcplicity) -
addMasterTable
-
retrieveMasterTables
A-(parent-to)->B-(parent-to)->C
then C.retrieveMasterTables will return "B" -
retrieveAllMasterTables
A-(parent-to)->B-(parent-to)->C
then C.retrieveAllMasterTables will return "A and B" -
resetForeignKeys
public void resetForeignKeys() -
retrieveForeignKeys
Description copied from class:SQLWrapper
Stub method to be over-written by LinkedSQLWrapper class.- Overrides:
retrieveForeignKeys
in classSQLWrapper
- Returns:
-
assignAccessMode
public void assignAccessMode(int accessMode) Similar to the COBOL ACCESS Mode- Specified by:
assignAccessMode
in interfaceISQLWrapper
- Overrides:
assignAccessMode
in classAbstractIndexedFile
- Parameters:
accessMode
- : types are defined in IPersistence.ACCESS_MODE_xxx : Sequential, Random or Dynamic
-
setToOpen
open clas, and dependent / linked classes- Throws:
IOCriticalException
-
open
open clas, and dependent / linked classes- Overrides:
open
in classAbstractIndexedFile
- Throws:
IOCriticalException
-
deleteRecord
Description copied from class:AbstractBasePersistence
when operation is Unsuccessful throw Exception (e.g KeyNotFountException). See com.softwaremining.wrappers.exceptions- Overrides:
deleteRecord
in classAbstractIndexedFile
- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
- Throws:
IOStatusException
-
updateRecord
Description copied from class:AbstractIndexedFile
Translation of COBOL REWRITE statement- Overrides:
updateRecord
in classAbstractIndexedFile
- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
- Throws:
IOStatusException
-
insert
public int insert()Description copied from class:AbstractIndexedFile
Insert a record - populate the values from the existing fields- Specified by:
insert
in interfaceISQLWrapper
- Overrides:
insert
in classAbstractIndexedFile
-
nextRecord
go to next- Overrides:
nextRecord
in classAbstractIndexedFile
- Returns:
- IPersistence.STATUS_SUCCESS if records are found, Otherwise returns other values from IPersistence;
- Throws:
IOStatusException
-
last
- Throws:
IOStatusException
-
lastRecord
- Throws:
IOStatusException
-
prevRecord
go to next- Overrides:
prevRecord
in classAbstractIndexedFile
- Returns:
- IPersistence.STATUS_SUCCESS if records are found, Otherwise returns other values from IPersistence;
- Throws:
IOStatusException
-
readRecord
go to next- Overrides:
readRecord
in classAbstractIndexedFile
- Returns:
- IPersistence.STATUS_SUCCESS if records are found, Otherwise returns other values from IPersistence;
- Throws:
IOStatusException
-
seek
Go to the record identified by key Condition type is one of : IPersistence.CONDITION_TYPE_NO_CONDITION = 0; IPersistence.CONDITION_TYPE_EQUALS = 1; IPersistence.CONDITION_TYPE_GREATER = 2; IPersistence.CONDITION_TYPE_LESS = 3; IPersistence.CONDITION_TYPE_GREATER_OR_EQUALS = 4; IPersistence.CONDITION_TYPE_LESS_OR_EQUALS = 5;- Overrides:
seek
in classAbstractIndexedFile
-
seek
Go to the record identified by key Condition type is one of : IPersistence.CONDITION_TYPE_NO_CONDITION = 0; IPersistence.CONDITION_TYPE_EQUALS = 1; IPersistence.CONDITION_TYPE_GREATER = 2; IPersistence.CONDITION_TYPE_LESS = 3; IPersistence.CONDITION_TYPE_GREATER_OR_EQUALS = 4; IPersistence.CONDITION_TYPE_LESS_OR_EQUALS = 5;- Overrides:
seek
in classAbstractIndexedFile
-
seek
Go to the record identified by key Condition type is one of : IPersistence.CONDITION_TYPE_NO_CONDITION = 0; IPersistence.CONDITION_TYPE_EQUALS = 1; IPersistence.CONDITION_TYPE_GREATER = 2; IPersistence.CONDITION_TYPE_LESS = 3; IPersistence.CONDITION_TYPE_GREATER_OR_EQUALS = 4; IPersistence.CONDITION_TYPE_LESS_OR_EQUALS = 5; -
seekChildren
equivalant of START record in COBOL- Parameters:
key
-conditionType
-- Throws:
IOStatusException
-
assignForeignKeyValues
-
close
public int close()Description copied from class:AbstractBasePersistence
Close the file- Specified by:
close
in interfaceISQLWrapper
- Overrides:
close
in classAbstractIndexedFile
- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
-
initializeParentAndChild
public void initializeParentAndChild() -
assignRecordKey
-
addRecordKeyField
- Parameters:
indexField
-
-
removeRecordKeys
public void removeRecordKeys() -
addRecordKeyField
- Parameters:
indexField
-
-
getDeclaredRecordKeys
-
retrieveNativeKeys
Native Keys refer to either a. any keys set by setRecordKey b. in absence of any keys defined by setRecordKey, then an additional index keys is created by SoftwareMining framework. This is usually called INDX_FLD_0;- Specified by:
retrieveNativeKeys
in interfaceISQLWrapper
- Overrides:
retrieveNativeKeys
in classSQLWrapper
- Returns:
-
assignForeignKeyReference
This says Child has a key to Master which will act as foreign Index. E.g. Master has field ID , CHild has field: Master_ID where Child.Master_id = Master_id- Parameters:
fKTableName
-fkField
-
-
findOwner
-
useOidTableForKeyGeneration
public boolean useOidTableForKeyGeneration()Stub method to be over-written by LinkedSQLWrapper class.- Specified by:
useOidTableForKeyGeneration
in interfaceISQLWrapper
- Overrides:
useOidTableForKeyGeneration
in classSQLWrapper
- Returns:
-
retrieveChildTables
-
isReadyForNextIMSRead
public boolean isReadyForNextIMSRead() -
assignReadyForNextIMSRead
public void assignReadyForNextIMSRead(boolean readyForNextIMSRead) -
isAllowSearchForChildern
public boolean isAllowSearchForChildern() -
assignAllowSearchForChildern
public void assignAllowSearchForChildern(boolean allowSearchForChildern)
-