Quadcap Embeddable Database

com.quadcap.sql.ExportedKeyConstraint Class Reference

Inheritance diagram for com.quadcap.sql.ExportedKeyConstraint:

com.quadcap.sql.ForeignKeyConstraint Externalizable com.quadcap.sql.Constraint Externalizable Externalizable List of all members.

Detailed Description

A hidden 'ExportedKeyConstraint' is created for tables that are referenced as foreign keys by other tables.

Author:
Stan Bailes

Definition at line 64 of file ExportedKeyConstraint.java.

Public Member Functions

 ExportedKeyConstraint ()
 Default constructor.

 ExportedKeyConstraint (String name, Vector colNames, String fTableName, Vector fColNames, ImportedKeyConstraint iConstraint, UniqueConstraint uConstraint) throws SQLException
 Explicit constructor for matching ImportedKeyConstraint.

void delete (Session session) throws SQLException, IOException
 Called when the constraint itself is being removed.

void checkUpdate (Session session, byte[] oldKey, Row row, Row oldRow, long rowId, Constraint activeIndex) throws SQLException, IOException
 ----UPDATE Called before a row is UPDATED, with an opportunity to signal a constraint violation if one can be detected.

void checkDelete (Session session, Row row, long rowId) throws SQLException, IOException
 ----DELETE Called before a row is DELETED, with an opportunity to signal a constraint violation if one can be detected.

void checkKeyRemoval (Session session, byte[] oldkey) throws SQLException, IOException
void readExternal (ObjectInput in) throws IOException, ClassNotFoundException
 Read me from a stream.

void writeExternal (ObjectOutput out) throws IOException
 Write me to a stream.


Package Functions

void setForeignKeyCols (int[] fCols)
ExportedKeys getExportedKeys (Session session) throws IOException
 Utility function to get / lazy-create the session context used to keep track of key additions and removals generated by the current statement.

ImportedKeyConstraint getImportedKeyConstraint (Database db) throws SQLException, IOException
Btree getForeignIndex (Database db) throws SQLException, IOException

Package Attributes

transient ImportedKeyConstraint iConstraint
transient String iConstraintName
String uConstraintName


Constructor & Destructor Documentation

com.quadcap.sql.ExportedKeyConstraint.ExportedKeyConstraint  ) 
 

Default constructor.

Definition at line 76 of file ExportedKeyConstraint.java.

com.quadcap.sql.ExportedKeyConstraint.ExportedKeyConstraint String  name,
Vector  colNames,
String  fTableName,
Vector  fColNames,
ImportedKeyConstraint  iConstraint,
UniqueConstraint  uConstraint
throws SQLException
 

Explicit constructor for matching ImportedKeyConstraint.

Definition at line 81 of file ExportedKeyConstraint.java.

References com.quadcap.sql.Constraint.getName(), and com.quadcap.sql.ExportedKeyConstraint.iConstraint.


Member Function Documentation

void com.quadcap.sql.ExportedKeyConstraint.checkDelete Session  session,
Row  row,
long  rowId
throws SQLException, IOException [virtual]
 

----DELETE Called before a row is DELETED, with an opportunity to signal a constraint violation if one can be detected.

Reimplemented from com.quadcap.sql.ForeignKeyConstraint.

Definition at line 129 of file ExportedKeyConstraint.java.

References com.quadcap.sql.ExportedKeys.addDeleteSelfRef(), com.quadcap.sql.ExportedKeyConstraint.checkDelete(), com.quadcap.sql.ExportedKeyConstraint.checkKeyRemoval(), com.quadcap.sql.ExportedKeyConstraint.getExportedKeys(), com.quadcap.sql.ExportedKeyConstraint.getImportedKeyConstraint(), and com.quadcap.sql.ForeignKeyConstraint.makeFKey().

Referenced by com.quadcap.sql.ExportedKeyConstraint.checkDelete().

void com.quadcap.sql.ExportedKeyConstraint.checkKeyRemoval Session  session,
byte[]  oldkey
throws SQLException, IOException
 

Definition at line 142 of file ExportedKeyConstraint.java.

References com.quadcap.sql.ExportedKeyConstraint.checkKeyRemoval(), com.quadcap.sql.index.Comparator.compare, com.quadcap.sql.ForeignKeyConstraint.getComparator(), com.quadcap.sql.index.Btree.getCursor(), com.quadcap.sql.ExportedKeyConstraint.getExportedKeys(), com.quadcap.sql.ExportedKeyConstraint.getForeignIndex(), com.quadcap.sql.index.BCursor.getKey(), com.quadcap.sql.Constraint.getRefAction(), com.quadcap.sql.ExportedKeyConstraint.iConstraint, com.quadcap.sql.index.BCursor.next(), com.quadcap.sql.index.BCursor.release(), com.quadcap.sql.ExportedKeys.removeKey(), and com.quadcap.sql.index.BCursor.seek().

Referenced by com.quadcap.sql.ExportedKeyConstraint.checkDelete(), com.quadcap.sql.ExportedKeyConstraint.checkKeyRemoval(), and com.quadcap.sql.ExportedKeys.finish().

void com.quadcap.sql.ExportedKeyConstraint.checkUpdate Session  session,
byte[]  oldKey,
Row  row,
Row  oldRow,
long  rowId,
Constraint  activeIndex
throws SQLException, IOException [virtual]
 

----UPDATE Called before a row is UPDATED, with an opportunity to signal a constraint violation if one can be detected.

Because the oldRow may be 'lazy', it's important to instantiate whatever items are going to be needed later by applyUpdate *now*, otherwise, apply may get the 'new' versions of those items, because the underlying byte stream is modified by the time applyUpdate gets called.

Implements com.quadcap.sql.Constraint.

Definition at line 109 of file ExportedKeyConstraint.java.

References com.quadcap.sql.ExportedKeys.addEntry(), com.quadcap.sql.ExportedKeys.addSelfRefEntry(), com.quadcap.sql.ExportedKeyConstraint.checkUpdate(), com.quadcap.sql.index.Comparator.compare, com.quadcap.sql.ForeignKeyConstraint.getComparator(), and com.quadcap.sql.ExportedKeyConstraint.getExportedKeys().

Referenced by com.quadcap.sql.ExportedKeyConstraint.checkUpdate().

void com.quadcap.sql.ExportedKeyConstraint.delete Session  session  )  throws SQLException, IOException [virtual]
 

Called when the constraint itself is being removed.

Constraints which allocate resources of any kind should release them here since they are about to be discarded and gc'ed.

Implements com.quadcap.sql.ForeignKeyConstraint.

Definition at line 97 of file ExportedKeyConstraint.java.

References com.quadcap.sql.Table.getConstraint(), com.quadcap.sql.UniqueConstraint.removeExportConstraint(), and com.quadcap.sql.ExportedKeyConstraint.uConstraintName.

ExportedKeys com.quadcap.sql.ExportedKeyConstraint.getExportedKeys Session  session  )  throws IOException [package]
 

Utility function to get / lazy-create the session context used to keep track of key additions and removals generated by the current statement.

Definition at line 189 of file ExportedKeyConstraint.java.

References com.quadcap.sql.ExportedKeyConstraint.getExportedKeys(), and com.quadcap.sql.ForeignKeyConstraint.isDeferred().

Referenced by com.quadcap.sql.ExportedKeyConstraint.checkDelete(), com.quadcap.sql.ExportedKeyConstraint.checkKeyRemoval(), com.quadcap.sql.ExportedKeyConstraint.checkUpdate(), and com.quadcap.sql.ExportedKeyConstraint.getExportedKeys().

Btree com.quadcap.sql.ExportedKeyConstraint.getForeignIndex Database  db  )  throws SQLException, IOException [package]
 

Definition at line 210 of file ExportedKeyConstraint.java.

References com.quadcap.sql.ExportedKeyConstraint.getForeignIndex(), and com.quadcap.sql.ImportedKeyConstraint.getIndex().

Referenced by com.quadcap.sql.ExportedKeyConstraint.checkKeyRemoval(), and com.quadcap.sql.ExportedKeyConstraint.getForeignIndex().

ImportedKeyConstraint com.quadcap.sql.ExportedKeyConstraint.getImportedKeyConstraint Database  db  )  throws SQLException, IOException [package]
 

Definition at line 199 of file ExportedKeyConstraint.java.

References com.quadcap.sql.Table.getConstraint(), com.quadcap.sql.ExportedKeyConstraint.getImportedKeyConstraint(), com.quadcap.sql.ExportedKeyConstraint.iConstraint, and com.quadcap.sql.ExportedKeyConstraint.iConstraintName.

Referenced by com.quadcap.sql.ExportedKeyConstraint.checkDelete(), com.quadcap.sql.DeleteConstraint.deleteForeign(), and com.quadcap.sql.ExportedKeyConstraint.getImportedKeyConstraint().

void com.quadcap.sql.ExportedKeyConstraint.readExternal ObjectInput  in  )  throws IOException, ClassNotFoundException
 

Read me from a stream.

Reimplemented from com.quadcap.sql.ForeignKeyConstraint.

Definition at line 214 of file ExportedKeyConstraint.java.

References com.quadcap.sql.ExportedKeyConstraint.iConstraintName, com.quadcap.sql.ExportedKeyConstraint.readExternal(), and com.quadcap.sql.ExportedKeyConstraint.uConstraintName.

Referenced by com.quadcap.sql.ExportedKeyConstraint.readExternal().

void com.quadcap.sql.ExportedKeyConstraint.setForeignKeyCols int[]  fCols  )  [package]
 

Definition at line 105 of file ExportedKeyConstraint.java.

References com.quadcap.sql.ExportedKeyConstraint.setForeignKeyCols().

Referenced by com.quadcap.sql.ImportedKeyConstraint.add(), and com.quadcap.sql.ExportedKeyConstraint.setForeignKeyCols().

void com.quadcap.sql.ExportedKeyConstraint.writeExternal ObjectOutput  out  )  throws IOException
 

Write me to a stream.

Reimplemented from com.quadcap.sql.ForeignKeyConstraint.

Definition at line 222 of file ExportedKeyConstraint.java.

References com.quadcap.sql.ExportedKeyConstraint.iConstraintName, com.quadcap.sql.ExportedKeyConstraint.uConstraintName, and com.quadcap.sql.ExportedKeyConstraint.writeExternal().

Referenced by com.quadcap.sql.ExportedKeyConstraint.writeExternal().


Member Data Documentation

transient ImportedKeyConstraint com.quadcap.sql.ExportedKeyConstraint.iConstraint [package]
 

Definition at line 67 of file ExportedKeyConstraint.java.

Referenced by com.quadcap.sql.ExportedKeyConstraint.checkKeyRemoval(), com.quadcap.sql.ExportedKeyConstraint.ExportedKeyConstraint(), and com.quadcap.sql.ExportedKeyConstraint.getImportedKeyConstraint().

transient String com.quadcap.sql.ExportedKeyConstraint.iConstraintName [package]
 

Definition at line 68 of file ExportedKeyConstraint.java.

Referenced by com.quadcap.sql.ExportedKeyConstraint.getImportedKeyConstraint(), com.quadcap.sql.ExportedKeyConstraint.readExternal(), and com.quadcap.sql.ExportedKeyConstraint.writeExternal().

String com.quadcap.sql.ExportedKeyConstraint.uConstraintName [package]
 

Definition at line 70 of file ExportedKeyConstraint.java.

Referenced by com.quadcap.sql.ExportedKeyConstraint.delete(), com.quadcap.sql.ExportedKeyConstraint.readExternal(), and com.quadcap.sql.ExportedKeyConstraint.writeExternal().