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,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 associatedintstatic final intnot used Used for when foreign keys are defined "EXPLICITLY" ...static final intnot used Used for when foreign keys are defined "IMPLICITLY" ...static final intBULL ids uses this strategy.protected intCondition 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 booleanUsed for when foreign keys are defined "IMPLICITLY" ...Fields inherited from class com.softwaremining.sql.SQLWrapper
connection, nativeKeys, openMode, postFixTableNameToImplicitDatabaseKey, resultSet, sequentialKeyGeneration, suppressNextReadCurrentFields inherited from class com.softwaremining.sql.AbstractIndexedFile
delegateDAOFields inherited from class com.softwaremining.wrappers.AbstractBasePersistence
fileName, ownerClassName, statusFields 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_setFieldFormattedFields 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 TypeMethodDescriptionvoidvoidaddMasterTable(LinkedSQLWrapper masterTable) voidaddRecordKeyField(AbstractCBLField indexField) voidaddRecordKeyField(CBLGroup indexGroup) voidassignAccessMode(int accessMode) Similar to the COBOL ACCESS ModevoidassignAllowSearchForChildern(boolean allowSearchForChildern) voidassignAwaitingSeek(ISMObject[] keys, int conditionType, boolean _masterSeekingChildren) voidassignForeignKeyReference(String fKTableName, AbstractCBLField fkField) This says Child has a key to Master which will act as foreign Index.voidassignForeignKeyValues(ISMObject[] keys, int conditionType) voidassignReadyForNextIMSRead(boolean readyForNextIMSRead) voidassignRecordKey(AbstractCBLField recordKey) intclose()Close the fileintwhen operation is Unsuccessful throw Exception (e.g KeyNotFountException).voidfindOwner(LinkedSQLWrapper master) voidintinsert()Insert a record - populate the values from the existing fieldsbooleanbooleanbooleanintlast()intvoidlinkChild(LinkedSQLWrapper childTable) intgo to nextintopen(int openMode) open clas, and dependent / linked classesintgo to nextintgo to nextvoidvoidA-(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.intGo 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;intGo 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;intGo 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 voidseekChildren(ISMObject[] keys, int conditionType) equivalent of START record in COBOLvoidsetKeyExcplicity(int keyExcplicity) protected intsetToOpen(int openMode) open clas, and dependent / linked classesintTranslation of COBOL REWRITE statementbooleanStub 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, assignAdditionalSQLForeignKeyCondition, assignAdditionalSQLOrderBy, assignAlternateKey, assignCachedSeekValues, assignChangeGEConditonToLIKE, assignChangeGTEQ2EQForLIKECondition, assignConnection, assignDbDecorator, assignExpandGTEQSearches, assignFetchDirectionIsForward, assignFetchSize, assignFileOpened, assignGDGCondition, assignGDGProperty, assignGenerate_OrderBy_ForReadStatements, assignIgnoreOriginalKeys, assignIncludeRedefinedFieldsInCRUD, assignKeyIsUnique, assignKeyValue, assignKeyValue, assignLastSeekCondition, assignLastSeekConditionLookedForEquality, assignLowerLimitForExpandGTEQSearches, assignOpenMode, assignRecordKey, assignRecordKey, assignRecordKeysAllDescending, assignRelativeKey, assignResultSet, assignResultSetFetchSize, assignRowFacade, assignSequentialKeyGeneration, assignSQLConditions, assignSQLTableName, assignSuppressSeek, assignTableName, assignThrowInvalidKeyException, assignTopRowSelectStrategyCount, assignTopRowSelectStrategyRange, assignTreatAsSQLWrapper, assignUpperLimitForExpandGTEQSearches, clearAdditionalSQLCondition, 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, retrieveIncludeRedefinedFieldsInCRUD, retrieveLastSeekCondition, retrieveOpenMode, retrieveRecordKey, retrieveRecordKeyValue, retrieveResultSet, retrieveResultSetFetchSize, retrieveRowFacade, retrieveTableName, retrieveThrowInvalidKeyException, retrieveTopRowSelectStrategyCount, retrieveTopRowSelectStrategyStartingRow, setLock, setRelativeKey, trimCachedSeekValues, validateConditionTypeMethods 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, updateMethods inherited from class com.softwaremining.wrappers.AbstractBasePersistence
assignFileName, assignLock, assignStatus, assignStatusAsPrimitive, assignStatusValue, assignStatusValue, readRow, retrieveAccessMode, retrieveFileName, retrieveFileName, retrieveFirstLevelEntry, retrieveSessionId, retrieveStatusField, retrieveStatusValueMethods 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, print, printFieldPosition, printFieldValues, printOrderedFieldPosition, resetCachedValues, resetCompressedFieldList, resetStorageManager, resetStructure, resize, retrieveActualLength, retrieveAsInt, retrieveAsString, retrieveCachedInitializationValue, retrieveCompressedFields, retrieveDependedFieldsList, retrieveEbcdicBytes, retrieveEbcdicValue, retrieveEncodedValue, retrieveField, retrieveField, retrieveFieldAtMemoryPosition, retrieveFieldFormatted, retrieveFields, retrieveIsTargetOfPointers, retrievePrimitiveFields, retrieveRawEbcdicBytes, retrieveRedefinesList, retrieveSQLObject, retrieveStorageBytes, retrieveStorageCellSize, retrieveSubstring, retrieveSubstring, retrieveTopLevelField, retrieveValue, retrieveValue, setValue, stringValue, subtractCorrespondingValue, subtractCorrespondingValue, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.softwaremining.wrappers.ISMBean
assignExemptFromMemRelease, assignSessionId, assignValue, initialize, isExemptFromMemRelease, isResourceAlreadyReleased, resetStructure, retrieveActualLength, retrieveAsString, retrieveField, retrieveField, retrieveTopLevelField, retrieveValue, stringValueMethods 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
-
masterTableList
-
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:SQLWrapperStub method to be over-written by LinkedSQLWrapper class.- Overrides:
retrieveForeignKeysin classSQLWrapper- Returns:
-
assignAccessMode
public void assignAccessMode(int accessMode) Similar to the COBOL ACCESS Mode- Specified by:
assignAccessModein interfaceISQLWrapper- Overrides:
assignAccessModein 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:
openin classAbstractIndexedFile- Throws:
IOCriticalException
-
deleteRecord
Description copied from class:AbstractBasePersistencewhen operation is Unsuccessful throw Exception (e.g KeyNotFountException). See com.softwaremining.wrappers.exceptions- Overrides:
deleteRecordin classAbstractIndexedFile- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
- Throws:
IOStatusException
-
updateRecord
Description copied from class:AbstractIndexedFileTranslation of COBOL REWRITE statement- Overrides:
updateRecordin classAbstractIndexedFile- Returns:
- when successful it returns IPersistence.STATUS_SUCCESS
- Throws:
IOStatusException
-
insert
public int insert()Description copied from class:AbstractIndexedFileInsert a record - populate the values from the existing fields- Specified by:
insertin interfaceISQLWrapper- Overrides:
insertin classAbstractIndexedFile
-
nextRecord
go to next- Overrides:
nextRecordin 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:
prevRecordin classAbstractIndexedFile- Returns:
- IPersistence.STATUS_SUCCESS if records are found, Otherwise returns other values from IPersistence;
- Throws:
IOStatusException
-
readRecord
go to next- Overrides:
readRecordin 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:
seekin 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:
seekin 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
equivalent of START record in COBOL- Parameters:
DEFAULT_key-conditionType-- Throws:
IOStatusException
-
assignForeignKeyValues
-
close
public int close()Description copied from class:AbstractBasePersistenceClose the file- Specified by:
closein interfaceISQLWrapper- Overrides:
closein 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:
retrieveNativeKeysin interfaceISQLWrapper- Overrides:
retrieveNativeKeysin 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:
useOidTableForKeyGenerationin interfaceISQLWrapper- Overrides:
useOidTableForKeyGenerationin classSQLWrapper- Returns:
-
retrieveChildTables
-
isReadyForNextIMSRead
public boolean isReadyForNextIMSRead() -
assignReadyForNextIMSRead
public void assignReadyForNextIMSRead(boolean readyForNextIMSRead) -
isAllowSearchForChildern
public boolean isAllowSearchForChildern() -
assignAllowSearchForChildern
public void assignAllowSearchForChildern(boolean allowSearchForChildern) -
isAwaitingSeek
public boolean isAwaitingSeek() -
assignAwaitingSeek
-
activateDelayedSeek
public void activateDelayedSeek()
-