|
Berkeley DB Java Edition version 1.5.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sleepycat.bind.tuple.TupleTupleKeyCreator
An abstract key creator that uses a tuple key and a tuple data entry. This
class takes care of converting the key and data entry to/from TupleInput
and TupleOutput
objects.
The following abstract method must be implemented by a concrete subclass
to create the index key using these objects
If ForeignKeyDeleteAction.NULLIFY
was
specified when opening the secondary database, the following method must be
overridden to nullify the foreign index key. If NULLIFY was not specified,
this method need not be overridden.
If ForeignKeyDeleteAction.NULLIFY
was
specified when creating the secondary, this method is called when the
entity for this foreign key is deleted. If NULLIFY was not specified,
this method will not be called and may always return false.
Constructor Summary | |
TupleTupleKeyCreator()
Creates a tuple-tuple key creator. |
Method Summary | |
boolean |
createSecondaryKey(SecondaryDatabase db,
DatabaseEntry primaryKeyEntry,
DatabaseEntry dataEntry,
DatabaseEntry indexKeyEntry)
Creates a secondary key entry, given a primary key and data entry. |
abstract boolean |
createSecondaryKey(TupleInput primaryKeyInput,
TupleInput dataInput,
TupleOutput indexKeyOutput)
Creates the index key from primary key tuple and data tuple. |
boolean |
nullifyForeignKey(SecondaryDatabase db,
DatabaseEntry dataEntry)
Sets the foreign key reference to null in the datum of the primary database. |
boolean |
nullifyForeignKey(TupleInput dataInput,
TupleOutput dataOutput)
Clears the index key in the tuple data entry. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TupleTupleKeyCreator()
Method Detail |
public boolean createSecondaryKey(SecondaryDatabase db, DatabaseEntry primaryKeyEntry, DatabaseEntry dataEntry, DatabaseEntry indexKeyEntry) throws DatabaseException
SecondaryKeyCreator
createSecondaryKey
in interface SecondaryKeyCreator
db
- the database to which the secondary key will be added.primaryKeyEntry
- the primary key entry. This parameter must not be modified
by this method.dataEntry
- the primary data entry. This parameter must not be modified
by this method.indexKeyEntry
- the secondary key created by this method.
DatabaseException
- if an error occurs attempting to create the
secondary key.public boolean nullifyForeignKey(SecondaryDatabase db, DatabaseEntry dataEntry) throws DatabaseException
ForeignKeyNullifier
nullifyForeignKey
in interface ForeignKeyNullifier
db
- the database in which the foreign key integrity constraint
is defined.dataEntry
- the existing primary key datum in which the foreign key
reference should be set to null.
DatabaseException
- if an error occurs attempting to clear the
key reference.public abstract boolean createSecondaryKey(TupleInput primaryKeyInput, TupleInput dataInput, TupleOutput indexKeyOutput)
primaryKeyInput
- is the TupleInput
for the primary key
entry.dataInput
- is the TupleInput
for the data entry.indexKeyOutput
- is the destination index key tuple.
public boolean nullifyForeignKey(TupleInput dataInput, TupleOutput dataOutput)
The secondary key should be output or removed by this method such
that createSecondaryKey(com.sleepycat.je.SecondaryDatabase, com.sleepycat.je.DatabaseEntry, com.sleepycat.je.DatabaseEntry, com.sleepycat.je.DatabaseEntry)
will return false. Other fields in the
data object should remain unchanged.
dataInput
- is the TupleInput
for the data entry.dataOutput
- is the destination TupleOutput
.
|
Berkeley DB Java Edition version 1.5.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |