| java.lang.Object com.quadcap.sql.Constraint com.quadcap.sql.ForeignKeyConstraint com.quadcap.sql.ImportedKeyConstraint
ImportedKeyConstraint | public class ImportedKeyConstraint extends ForeignKeyConstraint implements Externalizable(Code) | | Constraint for imported keys (i.e., this table references another
table)
author: Stan Bailes |
Method Summary | |
public void | add(Session session) For ALTER TABLE ADD CONSTRAINT, we need to build our
foreign index. | public void | applyDelete(Session session, Row row, long rowId, Constraint activeIndex) On delete, remove the constraints holding the corresponding
row values. | public void | applyInsert(Session session, Row row, long rowId, Constraint activeIndex) | public void | checkInsert(Session session, Row row) On insert, verify that the referenced keys exist in the foreign
table. | boolean | checkSelfReferencing(Row row) Check for the possibility that a row satisfies its own constraints. | public void | checkUpdate(Session session, byte[] oldKey, Row row, Row oldRow, long rowId, Constraint activeIndex) On update, if the imported key changes, we need to modify the
index. | public void | delete(Session session) On ALTER TABLE DROP CONSTRAINT, delete the index and free
the file resources it holds. | public ExportedKeyConstraint | findExportedKeyConstraint(Database db) Get the export constraint if it exists already. | final String | getExportConstraintName() Return a name for the auto-generated 'export' constraint. | final Btree | getForeignIndex(Session session) Get (create if necessary) the Btree for the foreign index. | public Btree | getIndex(Database db) Get the index (create it if necessary). | byte[] | makeKey(Session session, Row row, long rowId) For the purposes of creating a unique key, the rowId is included,
whereas for purposes of checking foreign key integrity, the rowId
is ignored, only the key value matters. | public void | readExternal(ObjectInput in) | public void | writeExternal(ObjectOutput out) |
indexRoot | long indexRoot(Code) | | |
ImportedKeyConstraint | public ImportedKeyConstraint()(Code) | | Default constructor required for serialization
|
ImportedKeyConstraint | public ImportedKeyConstraint(String name, String fTableName)(Code) | | Explicit constructor parser.
|
ImportedKeyConstraint | public ImportedKeyConstraint(String name, Vector colNames, String fTableName, Vector fColNames)(Code) | | Explicit constructor with named columns
|
checkSelfReferencing | boolean checkSelfReferencing(Row row) throws SQLException(Code) | | Check for the possibility that a row satisfies its own constraints.
It's a strange world we live in, get used to it.
|
checkUpdate | public void checkUpdate(Session session, byte[] oldKey, Row row, Row oldRow, long rowId, Constraint activeIndex) throws SQLException, IOException(Code) | | On update, if the imported key changes, we need to modify the
index. Once this happens, we create a session context in which
to record the index changes so we can do them all together, at
the end.
|
getExportConstraintName | final String getExportConstraintName()(Code) | | Return a name for the auto-generated 'export' constraint.
|
getIndex | public Btree getIndex(Database db) throws IOException(Code) | | Get the index (create it if necessary). The key for this index includes
the actual key fields plus the row id to ensure uniqueness for Btreee
operations. Some operations require that we use a special comparator
which ignores the rowId part.
|
makeKey | byte[] makeKey(Session session, Row row, long rowId) throws SQLException(Code) | | For the purposes of creating a unique key, the rowId is included,
whereas for purposes of checking foreign key integrity, the rowId
is ignored, only the key value matters.
|
Methods inherited from com.quadcap.sql.ForeignKeyConstraint | public void add(Session session) throws SQLException, IOException(Code)(Java Doc) public void applyDelete(Session session, Row row, long rowId, Constraint activeIndex) throws SQLException, IOException(Code)(Java Doc) public void applyInsert(Session session, Row row, long rowId, Constraint activeIndex) throws SQLException, IOException(Code)(Java Doc) public void applyUpdate(Session session, byte[] oldKey, Row row, Row oldRow, long rowId, Constraint activeIndex) throws SQLException, IOException(Code)(Java Doc) public void checkDelete(Session session, Row row, long rowId) throws SQLException, IOException(Code)(Java Doc) public void checkInsert(Session session, Row row) throws SQLException, IOException(Code)(Java Doc) public void checkUpdate(Session session, Row row, long rowId) throws SQLException, IOException(Code)(Java Doc) abstract public void delete(Session session) throws SQLException, IOException(Code)(Java Doc) final Comparator getComparator() throws SQLException(Code)(Java Doc) public int[] getFCols(Database db) throws SQLException, IOException(Code)(Java Doc) public Table getFTable(Database db) throws SQLException, IOException(Code)(Java Doc) public String getFTableName()(Code)(Java Doc) final public boolean isDeferred()(Code)(Java Doc) boolean isSelfReferencing(Database db) throws IOException, SQLException(Code)(Java Doc) public byte[] makeFKey(Session session, Row row) throws IOException, SQLException(Code)(Java Doc) public byte[] makeKey(Session session, Row row) throws SQLException(Code)(Java Doc) public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException(Code)(Java Doc) public void resetColumns() throws SQLException(Code)(Java Doc) public void setFTableName(String s)(Code)(Java Doc) public void setForeignColumn(String name)(Code)(Java Doc) public String toString()(Code)(Java Doc) public void writeExternal(ObjectOutput out) throws IOException(Code)(Java Doc)
|
Methods inherited from com.quadcap.sql.Constraint | abstract public void add(Session session) throws SQLException, IOException(Code)(Java Doc) abstract public void applyDelete(Session session, Row row, long rowId, Constraint activeIndex) throws SQLException, IOException(Code)(Java Doc) abstract public void applyInsert(Session session, Row row, long rowId, Constraint activeIndex) throws SQLException, IOException(Code)(Java Doc) abstract public void applyUpdate(Session session, byte[] oldKey, Row row, Row oldRow, long rowId, Constraint activeIndex) throws SQLException, IOException(Code)(Java Doc) abstract public void checkDelete(Session session, Row row, long rowId) throws SQLException, IOException(Code)(Java Doc) abstract public void checkInsert(Session session, Row row) throws SQLException, IOException(Code)(Java Doc) abstract public void checkUpdate(Session session, byte[] oldKey, Row row, Row oldRow, long rowId, Constraint activeIndex) throws SQLException, IOException(Code)(Java Doc) abstract public void delete(Session session) throws SQLException, IOException(Code)(Java Doc) public Column getColumn() throws SQLException(Code)(Java Doc) public Column getColumn(int c) throws SQLException(Code)(Java Doc) public int getColumnCount()(Code)(Java Doc) public Vector getColumnNames() throws SQLException(Code)(Java Doc) public int[] getColumns() throws SQLException(Code)(Java Doc) public Btree getIndex(Database db) throws IOException(Code)(Java Doc) public String getName()(Code)(Java Doc) public int getPriority()(Code)(Java Doc) public int getRefAction(int opType)(Code)(Java Doc) public String getRefActionString(int opType)(Code)(Java Doc) public int getSpec()(Code)(Java Doc) public Table getTable()(Code)(Java Doc) public boolean isDeferred()(Code)(Java Doc) public boolean isGlobal()(Code)(Java Doc) public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException(Code)(Java Doc) public void resetColumns() throws SQLException(Code)(Java Doc) public void setColumn(Column column)(Code)(Java Doc) public void setDeferrable(int def)(Code)(Java Doc) public void setGlobal(boolean g)(Code)(Java Doc) public void setName(String name)(Code)(Java Doc) public void setRefSpec(int ref)(Code)(Java Doc) public void setTable(Table table) throws SQLException(Code)(Java Doc) public String toString()(Code)(Java Doc) public void undoAdd(Session session) throws SQLException, IOException(Code)(Java Doc) public void undoDelete(Session session) throws SQLException, IOException(Code)(Java Doc) public void writeExternal(ObjectOutput out) throws IOException(Code)(Java Doc)
|
|
|