Top Description Fields Constructors Methods
org.apache.derby.impl.sql.execute

public Class FKInfo

extends Object
implements Formatable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.services.io.TypedFormat, java.io.Externalizable, java.io.Serializable
Imports
java.io.IOException, .ObjectInput, .ObjectOutput, .StreamCorruptedException, java.util.Vector, org.apache.derby.catalog.UUID, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.util.ArrayUtil, org.apache.derby.iapi.services.io.FormatIdUtil, .Formatable, .StoredFormatIds, org.apache.derby.iapi.services.monitor.Monitor, org.apache.derby.iapi.types.RowLocation, org.apache.derby.shared.common.sanity.SanityManager

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.

Field Summary

Modifier and TypeField and Description
pack-priv int[]
pack-priv boolean[]
pack-priv long[]
pack-priv String[]
pack-priv UUID[]
pack-priv boolean[]
private UUID[]
public static final int
FOREIGN_KEY

This class implements Formatable.

pack-priv int[]
pack-priv long
pack-priv UUID
pack-priv boolean
public static final int
pack-priv UUID
pack-priv RowLocation
pack-priv String
pack-priv int
pack-priv String
pack-priv int

Constructor Summary

AccessConstructor and Description
public
FKInfo()

Niladic constructor for Formattable

public
FKInfo(String[]
the foreign key constraint names
fkConstraintNames
,
String
the name of the schema of the table being modified
schemaName
,
String
the name of the table being modified
tableName
,
int
the type of the statement: e.g. StatementType.INSERT
stmtType
,
int
either FKInfo.REFERENCED_KEY or FKInfo.FOREIGN_KEY
type
,
UUID
UUID of the referenced constraint's supporting index
refUUID
,
long
conglomerate number of the referenced key
refConglomNumber
,
UUID
UUID of the referenced constraint
refConstraintID
,
boolean
true iff the referenced key constraint is deferrable
refConstraintIsDeferrable
,
UUID[]
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 keys
fkUUIDs
,
long[]
array of conglomerate numbers, corresponds to fkUUIDs
fkConglomNumbers
,
boolean[]
array of conglomerate booleans indicating whether the foreign key references a key in the same table
fkIsSelfReferencing
,
int[]
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.
colArray
,
RowLocation
a row location template for the target table used to pass in a template row to tc.openScan()
rowLocation
,
int[]
referential action rules
raRules
,
boolean[]
the corresponding constraint is deferrable
deferrable
,
UUID[]
the foreign key constraints' uuids.
fkIds
)

Constructor for FKInfo

Method Summary

Modifier and TypeMethod and Description
public static FKInfo[]

Returns:

array of relevant fkinfos
chooseRelevantFKInfos
(FKInfo[]
array of fkinfos
fkInfo
,
int[]
array of columns
cols
,
boolean
take all with type == FOREIGN_KEY
addAllTypeIsFK
)

Comb through the FKInfo structures and pick out the ones that have columns that intersect with the input columns.

public int

Returns:

the formatID of this class
getTypeFormatId
()

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Get the formatID which corresponds to this class.

public void
readExternal(ObjectInput
read this.
in
)

Implements java.io.Externalizable.readExternal.

Read this object from a stream of stored objects.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
writeExternal(ObjectOutput
write bytes here
out
)

Implements java.io.Externalizable.writeExternal.

Write this object out

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

colArrayback to summary
pack-priv int[] colArray
deferrableback to summary
pack-priv boolean[] deferrable
fkConglomNumbersback to summary
pack-priv long[] fkConglomNumbers
fkConstraintNamesback to summary
pack-priv String[] fkConstraintNames
fkIdsback to summary
pack-priv UUID[] fkIds
fkIsSelfReferencingback to summary
pack-priv boolean[] fkIsSelfReferencing
fkUUIDsback to summary
private UUID[] fkUUIDs
FOREIGN_KEYback to summary
public static final int FOREIGN_KEY

This 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.

raRulesback to summary
pack-priv int[] raRules
refConglomNumberback to summary
pack-priv long refConglomNumber
refConstraintIDback to summary
pack-priv UUID refConstraintID
refConstraintIsDeferrableback to summary
pack-priv boolean refConstraintIsDeferrable
REFERENCED_KEYback to summary
public static final int REFERENCED_KEY
refUUIDback to summary
pack-priv UUID refUUID
rowLocationback to summary
pack-priv RowLocation rowLocation
schemaNameback to summary
pack-priv String schemaName
stmtTypeback to summary
pack-priv int stmtType
tableNameback to summary
pack-priv String tableName
typeback to summary
pack-priv int type

Constructor Detail

FKInfoback to summary
public FKInfo()

Niladic constructor for Formattable

FKInfoback to summary
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:String[]

the foreign key constraint names

schemaName:String

the name of the schema of the table being modified

tableName:String

the name of the table being modified

stmtType:int

the type of the statement: e.g. StatementType.INSERT

type:int

either FKInfo.REFERENCED_KEY or FKInfo.FOREIGN_KEY

refUUID:UUID

UUID of the referenced constraint's supporting index

refConglomNumber:long

conglomerate number of the referenced key

refConstraintID:UUID

UUID of the referenced constraint

refConstraintIsDeferrable:boolean

true iff the referenced key constraint is deferrable

fkUUIDs:UUID[]

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 keys

fkConglomNumbers:long[]

array of conglomerate numbers, corresponds to fkUUIDs

fkIsSelfReferencing:boolean[]

array of conglomerate booleans indicating whether the foreign key references a key in the same table

colArray:int[]

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:RowLocation

a row location template for the target table used to pass in a template row to tc.openScan()

raRules:int[]

referential action rules

deferrable:boolean[]

the corresponding constraint is deferrable

fkIds:UUID[]

the foreign key constraints' uuids.

Method Detail

chooseRelevantFKInfosback to summary
public static 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.

Parameters
fkInfo:FKInfo[]

array of fkinfos

cols:int[]

array of columns

addAllTypeIsFK:boolean

take all with type == FOREIGN_KEY

Returns:FKInfo[]

array of relevant fkinfos

getTypeFormatIdback to summary
public int getTypeFormatId()

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Get the formatID which corresponds to this class.

Returns:int

the formatID of this class

readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Implements java.io.Externalizable.readExternal.

Read this object from a stream of stored objects.

Parameters
in:ObjectInput

read this.

Exceptions
IOException:
thrown on error
ClassNotFoundException:
thrown on error
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Implements java.io.Externalizable.writeExternal.

Write this object out

Parameters
out:ObjectOutput

write bytes here

Exceptions
IOException:
thrown on error