Quadcap Embeddable Database

com.quadcap.sql.CheckConstraint Class Reference

Inheritance diagram for com.quadcap.sql.CheckConstraint:

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

Detailed Description

Constraint class for SQL CHECK constraints.

Author:
Stan Bailes

Definition at line 57 of file CheckConstraint.java.

Public Member Functions

 CheckConstraint ()
 CheckConstraint (String name, Expression expression)
void add (Session session) throws SQLException
 Called when the constraint is added.

void delete (Session session)
 Called when the constraint itself is being removed.

void undoDelete (Session session)
 Called to undo a constraint-add operation.

void applyInsert (Session session, Row row, long rowId, Constraint activeIndex) throws SQLException, IOException
 Called after the specified row has been inserted, with the resulting row ID, and with the active index.

void applyDelete (Session session, Row row, long rowId, Constraint activeIndex) throws SQLException, IOException
 Called after a row has been deleted, with the old row and row ID.

final void checkValue (Value val) throws SQLException
void checkInsert (Session session, Row row) throws SQLException, IOException
 ---INSERT Called before a row is INSERTED, with an opportunity to signal a constraint violation if one can be detected.

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 applyUpdate (Session session, byte[] oldKey, Row row, Row oldRow, long rowId, Constraint activeIndex) throws SQLException, IOException
 Called after a row has been updated, with the old row, old key, new row and row ID.

void readExternal (ObjectInput in) throws IOException, ClassNotFoundException
 Read me from a stream.

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


Package Attributes

Expression expression


Constructor & Destructor Documentation

com.quadcap.sql.CheckConstraint.CheckConstraint  ) 
 

Definition at line 60 of file CheckConstraint.java.

com.quadcap.sql.CheckConstraint.CheckConstraint String  name,
Expression  expression
 

Definition at line 62 of file CheckConstraint.java.


Member Function Documentation

void com.quadcap.sql.CheckConstraint.add Session  session  )  throws SQLException [virtual]
 

Called when the constraint is added.

Constraints which maintain state (e.g., indexes) can build their initial data structures (or whatever it is that they do at this time)

Implements com.quadcap.sql.Constraint.

Definition at line 67 of file CheckConstraint.java.

References com.quadcap.sql.CheckConstraint.add(), com.quadcap.sql.CheckConstraint.checkValue(), com.quadcap.sql.Cursor.close(), com.quadcap.sql.CheckConstraint.expression, com.quadcap.sql.Table.getCursor(), com.quadcap.sql.Expression.getValue(), com.quadcap.sql.Table.isUnderConstruction(), and com.quadcap.sql.Cursor.next().

Referenced by com.quadcap.sql.CheckConstraint.add().

void com.quadcap.sql.CheckConstraint.applyDelete Session  session,
Row  row,
long  rowId,
Constraint  activeIndex
throws SQLException, IOException [virtual]
 

Called after a row has been deleted, with the old row and row ID.

Constraints which maintain state (such as an index) would extend this class and implement this method to update the index.

Implements com.quadcap.sql.Constraint.

Definition at line 91 of file CheckConstraint.java.

References com.quadcap.sql.CheckConstraint.applyDelete().

Referenced by com.quadcap.sql.CheckConstraint.applyDelete().

void com.quadcap.sql.CheckConstraint.applyInsert Session  session,
Row  row,
long  rowId,
Constraint  activeIndex
throws SQLException, IOException [virtual]
 

Called after the specified row has been inserted, with the resulting row ID, and with the active index.

Constraints which maintain state (such as an index) would extend this class and implement this method to update the index

Implements com.quadcap.sql.Constraint.

Definition at line 85 of file CheckConstraint.java.

References com.quadcap.sql.CheckConstraint.applyInsert().

Referenced by com.quadcap.sql.CheckConstraint.applyInsert().

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

Called after a row has been updated, with the old row, old key, new row and row ID.

Constraints which maintain state (such as an index) would extend this class and implement this method to update the index.

Implements com.quadcap.sql.Constraint.

Definition at line 129 of file CheckConstraint.java.

References com.quadcap.sql.CheckConstraint.applyUpdate().

Referenced by com.quadcap.sql.CheckConstraint.applyUpdate().

void com.quadcap.sql.CheckConstraint.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.

Implements com.quadcap.sql.Constraint.

Definition at line 124 of file CheckConstraint.java.

References com.quadcap.sql.CheckConstraint.checkDelete().

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

void com.quadcap.sql.CheckConstraint.checkInsert Session  session,
Row  row
throws SQLException, IOException [virtual]
 

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

Implements com.quadcap.sql.Constraint.

Definition at line 109 of file CheckConstraint.java.

References com.quadcap.sql.CheckConstraint.checkInsert(), com.quadcap.sql.CheckConstraint.expression, com.quadcap.sql.Expression.getValue(), and com.quadcap.sql.StaticCursor.next().

Referenced by com.quadcap.sql.CheckConstraint.checkInsert().

void com.quadcap.sql.CheckConstraint.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 117 of file CheckConstraint.java.

References com.quadcap.sql.CheckConstraint.checkUpdate().

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

final void com.quadcap.sql.CheckConstraint.checkValue Value  val  )  throws SQLException
 

Definition at line 97 of file CheckConstraint.java.

References com.quadcap.sql.CheckConstraint.checkValue(), and com.quadcap.sql.CheckConstraint.expression.

Referenced by com.quadcap.sql.CheckConstraint.add(), and com.quadcap.sql.CheckConstraint.checkValue().

void com.quadcap.sql.CheckConstraint.delete Session  session  )  [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.Constraint.

Definition at line 82 of file CheckConstraint.java.

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

Read me from a stream.

Reimplemented from com.quadcap.sql.Constraint.

Definition at line 135 of file CheckConstraint.java.

References com.quadcap.sql.CheckConstraint.expression, and com.quadcap.sql.CheckConstraint.readExternal().

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

void com.quadcap.sql.CheckConstraint.undoDelete Session  session  ) 
 

Called to undo a constraint-add operation.

Reimplemented from com.quadcap.sql.Constraint.

Definition at line 83 of file CheckConstraint.java.

References com.quadcap.sql.CheckConstraint.undoDelete().

Referenced by com.quadcap.sql.CheckConstraint.undoDelete().

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

Write me to a stream.

Reimplemented from com.quadcap.sql.Constraint.

Definition at line 142 of file CheckConstraint.java.

References com.quadcap.sql.CheckConstraint.expression, and com.quadcap.sql.CheckConstraint.writeExternal().

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


Member Data Documentation

Expression com.quadcap.sql.CheckConstraint.expression [package]
 

Definition at line 58 of file CheckConstraint.java.

Referenced by com.quadcap.sql.CheckConstraint.add(), com.quadcap.sql.CheckConstraint.checkInsert(), com.quadcap.sql.CheckConstraint.checkValue(), com.quadcap.sql.CheckConstraint.readExternal(), and com.quadcap.sql.CheckConstraint.writeExternal().