Class FKInfo
java.lang.Object
org.apache.derby.impl.sql.execute.FKInfo
- All Implemented Interfaces:
Externalizable
,Serializable
,Formatable
,TypedFormat
This is a simple class used to store the run time information
about a foreign key. Used by DML to figure out what to
check.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int[]
(package private) boolean[]
(package private) long[]
(package private) String[]
(package private) UUID[]
(package private) boolean[]
private UUID[]
static final int
This class implements Formatable.(package private) int[]
(package private) long
(package private) UUID
(package private) boolean
static final int
(package private) UUID
(package private) RowLocation
(package private) String
(package private) int
(package private) String
(package private) int
-
Constructor Summary
ConstructorsConstructorDescriptionFKInfo()
Niladic constructor for FormattableFKInfo
(String[] fkConstraintNames, String schemaName, String tableName, int stmtType, int type, UUID refUUID, long refConglomNumber, UUID refConstraintID, boolean refConstraintIsDeferrable, UUID[] fkUUIDs, long[] fkConglomNumbers, boolean[] fkIsSelfReferencing, int[] colArray, RowLocation rowLocation, int[] raRules, boolean[] deferrable, UUID[] fkIds) Constructor for FKInfo -
Method Summary
Modifier and TypeMethodDescriptionstatic FKInfo[]
chooseRelevantFKInfos
(FKInfo[] fkInfo, int[] cols, boolean addAllTypeIsFK) Comb through the FKInfo structures and pick out the ones that have columns that intersect with the input columns.int
Get the formatID which corresponds to this class.void
Read this object from a stream of stored objects.toString()
void
Write this object out
-
Field Details
-
FOREIGN_KEY
public static final int FOREIGN_KEYThis class implements Formatable. That means that it can write itself to and from a formatted stream. If you add more fields to this class, make sure that you also write/read them with the writeExternal()/readExternal() methods. If, between releases, you add more fields to this class, then you should bump the version number emitted by the getTypeFormatId() method. OR, since this is something that is used in stored prepared statements, it is ok to change it if you make sure that stored prepared statements are invalidated across releases.- See Also:
-
REFERENCED_KEY
public static final int REFERENCED_KEY- See Also:
-
schemaName
String schemaName -
tableName
String tableName -
type
int type -
refUUID
UUID refUUID -
refConglomNumber
long refConglomNumber -
refConstraintID
UUID refConstraintID -
refConstraintIsDeferrable
boolean refConstraintIsDeferrable -
stmtType
int stmtType -
rowLocation
RowLocation rowLocation -
fkConstraintNames
String[] fkConstraintNames -
fkUUIDs
-
fkConglomNumbers
long[] fkConglomNumbers -
fkIds
UUID[] fkIds -
fkIsSelfReferencing
boolean[] fkIsSelfReferencing -
colArray
int[] colArray -
raRules
int[] raRules -
deferrable
boolean[] deferrable
-
-
Constructor Details
-
FKInfo
public FKInfo()Niladic constructor for Formattable -
FKInfo
public FKInfo(String[] fkConstraintNames, String schemaName, String tableName, int stmtType, int type, UUID refUUID, long refConglomNumber, UUID refConstraintID, boolean refConstraintIsDeferrable, UUID[] fkUUIDs, long[] fkConglomNumbers, boolean[] fkIsSelfReferencing, int[] colArray, RowLocation rowLocation, int[] raRules, boolean[] deferrable, UUID[] fkIds) Constructor for FKInfo- Parameters:
fkConstraintNames
- the foreign key constraint namesschemaName
- the name of the schema of the table being modifiedtableName
- the name of the table being modifiedstmtType
- the type of the statement: e.g. StatementType.INSERTtype
- either FKInfo.REFERENCED_KEY or FKInfo.FOREIGN_KEYrefUUID
- UUID of the referenced constraint's supporting indexrefConglomNumber
- conglomerate number of the referenced keyrefConstraintID
- UUID of the referenced constraintrefConstraintIsDeferrable
-true
iff the referenced key constraint is deferrablefkUUIDs
- an array of fkUUIDs of backing indexes. if FOREIGN_KEY, then just one element, the backing index of the referenced keys. if REFERENCED_KEY, then all the foreign keysfkConglomNumbers
- array of conglomerate numbers, corresponds to fkUUIDsfkIsSelfReferencing
- array of conglomerate booleans indicating whether the foreign key references a key in the same tablecolArray
- map of columns to the base row that DML is changing. 1 based. Note that this maps the constraint index to a row in the target table of the current DML operation.rowLocation
- a row location template for the target table used to pass in a template row to tc.openScan()raRules
- referential action rulesdeferrable
- the corresponding constraint is deferrablefkIds
- the foreign key constraints' uuids.
-
-
Method Details
-
chooseRelevantFKInfos
Comb through the FKInfo structures and pick out the ones that have columns that intersect with the input columns.- Parameters:
fkInfo
- array of fkinfoscols
- array of columnsaddAllTypeIsFK
- take all with type == FOREIGN_KEY- Returns:
- array of relevant fkinfos
-
writeExternal
Write this object out- Specified by:
writeExternal
in interfaceExternalizable
- Parameters:
out
- write bytes here- Throws:
IOException
- thrown on error
-
readExternal
Read this object from a stream of stored objects.- Specified by:
readExternal
in interfaceExternalizable
- Parameters:
in
- read this.- Throws:
IOException
- thrown on errorClassNotFoundException
- thrown on error
-
getTypeFormatId
public int getTypeFormatId()Get the formatID which corresponds to this class.- Specified by:
getTypeFormatId
in interfaceTypedFormat
- Returns:
- the formatID of this class
-
toString
-