| java.lang.Object com.quadcap.sql.Constraint
All known Subclasses: com.quadcap.sql.NotNullConstraint, com.quadcap.sql.ForeignKeyConstraint, com.quadcap.sql.CheckConstraint, com.quadcap.sql.IndexConstraint, com.quadcap.sql.AutoNumberConstraint,
Constraint | abstract public class Constraint implements Externalizable(Code) | | A constraint is a condition which must be satisfied relative to
the rows of a table. Constraint checking hooks are available for
both before and after table-modifying operations.
author: Stan Bailes |
Method Summary | |
abstract public void | add(Session session) Called when the constraint is added. | abstract public void | applyDelete(Session session, Row row, long rowId, Constraint activeIndex) Called after a row has been deleted, with the old row and row ID. | abstract public void | applyInsert(Session session, Row row, long rowId, Constraint activeIndex) Called after the specified row has been inserted, with the resulting
row ID, and with the active index. | abstract public void | applyUpdate(Session session, byte[] oldKey, Row row, Row oldRow, long rowId, Constraint activeIndex) Called after a row has been updated, with the old row, old key,
new row and row ID. | abstract public void | checkDelete(Session session, Row row, long rowId) ----DELETE
Called before a row is DELETED, with an opportunity to signal a
constraint violation if one can be detected. | abstract public void | checkInsert(Session session, Row row) ---INSERT
Called before a row is INSERTED, with an opportunity to signal
a constraint violation if one can be detected. | abstract public void | checkUpdate(Session session, byte[] oldKey, Row row, Row oldRow, long rowId, Constraint activeIndex) ----UPDATE
Called before a row is UPDATED, with an opportunity to signal a
constraint violation if one can be detected. | abstract public void | delete(Session session) Called when the constraint itself is being removed. | public Column | getColumn() | public Column | getColumn(int c) | public int | getColumnCount() Return the number of columns described by the constraint. | public Vector | getColumnNames() | public int[] | getColumns() Return the integer indexes in the table's column list of the
columns in this constraint. | public Btree | getIndex(Database db) Funny, but a lot of constraints have indexes. | public String | getName() | public int | getPriority() Higher priority (larger numbers) execute first. | public int | getRefAction(int opType) | public String | getRefActionString(int opType) | public int | getSpec() | public Table | getTable() | public boolean | isDeferred() | public boolean | isGlobal() | public void | readExternal(ObjectInput in) | public void | resetColumns() Reset any mapped columns (e.g. | public void | setColumn(Column column) Convenience method for setting single column constraints. | public void | setDeferrable(int def) | public void | setGlobal(boolean g) | public void | setName(String name) | public void | setRefSpec(int ref) | public void | setTable(Table table) | public String | toString() | public void | undoAdd(Session session) Called to undo a constraint-add operation. | public void | undoDelete(Session session) Called to undo a constraint-add operation. | public void | writeExternal(ObjectOutput out) |
CASCADE | final public static int CASCADE(Code) | | |
DEFERRABLE | final public static int DEFERRABLE(Code) | | |
DELETE | final public static int DELETE(Code) | | |
FULL | final public static int FULL(Code) | | |
GLOBAL | final public static int GLOBAL(Code) | | |
INIT_DEFERRED | final public static int INIT_DEFERRED(Code) | | |
NOACTION | final public static int NOACTION(Code) | | |
PARTIAL | final public static int PARTIAL(Code) | | |
SETDEFAULT | final public static int SETDEFAULT(Code) | | |
SETNULL | final public static int SETNULL(Code) | | |
UPDATE | final public static int UPDATE(Code) | | |
columns | transient int[] columns(Code) | | |
refActions | static String[] refActions(Code) | | String names for Various referential actions
|
Constraint | public Constraint()(Code) | | Default constructor
|
Constraint | public Constraint(String name)(Code) | | Construct a named constraint
|
Constraint | public Constraint(String name, Vector colNames)(Code) | | Construct a named constraint with a list of columns
|
add | abstract public void add(Session session) throws SQLException, IOException(Code) | | 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)
|
applyDelete | abstract public void applyDelete(Session session, Row row, long rowId, Constraint activeIndex) throws SQLException, IOException(Code) | | 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.
|
applyInsert | abstract public void applyInsert(Session session, Row row, long rowId, Constraint activeIndex) throws SQLException, IOException(Code) | | 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
|
applyUpdate | abstract public void applyUpdate(Session session, byte[] oldKey, Row row, Row oldRow, long rowId, Constraint activeIndex) throws SQLException, IOException(Code) | | 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.
|
checkDelete | abstract public void checkDelete(Session session, Row row, long rowId) throws SQLException, IOException(Code) | | ----DELETE
Called before a row is DELETED, with an opportunity to signal a
constraint violation if one can be detected.
|
checkInsert | abstract public void checkInsert(Session session, Row row) throws SQLException, IOException(Code) | | ---INSERT
Called before a row is INSERTED, with an opportunity to signal
a constraint violation if one can be detected.
|
checkUpdate | abstract public void checkUpdate(Session session, byte[] oldKey, Row row, Row oldRow, long rowId, Constraint activeIndex) throws SQLException, IOException(Code) | | ----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.
|
delete | abstract public void delete(Session session) throws SQLException, IOException(Code) | | 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.
|
getColumn | public Column getColumn() throws SQLException(Code) | | For the simple, single column constraint, the constraint's column
exception: SQLException - if called for a multi-column constraint. |
getColumnCount | public int getColumnCount()(Code) | | Return the number of columns described by the constraint.
|
getColumnNames | public Vector getColumnNames() throws SQLException(Code) | | Return a vector containing all of the column names
|
getColumns | public int[] getColumns() throws SQLException(Code) | | Return the integer indexes in the table's column list of the
columns in this constraint. We return a copy of our internal
array, for speed, and trust the caller to not mess with the
array...
|
getIndex | public Btree getIndex(Database db) throws IOException(Code) | | Funny, but a lot of constraints have indexes. For the ones that
do, this can be a nifty little function.
|
getName | public String getName()(Code) | | Return the constraint's name
|
getPriority | public int getPriority()(Code) | | Higher priority (larger numbers) execute first.
|
getRefAction | public int getRefAction(int opType)(Code) | | Get the referential action for the specified operation (UPD OR DEL)
|
getRefActionString | public String getRefActionString(int opType)(Code) | | Return the referential action for the specified operation
|
getSpec | public int getSpec()(Code) | | Return the referential integrity and deferrability flags
|
getTable | public Table getTable()(Code) | | Get the constraint's table
|
isDeferred | public boolean isDeferred()(Code) | | Is this constraint 'deferred'?
|
isGlobal | public boolean isGlobal()(Code) | | Get the 'global' flag
|
resetColumns | public void resetColumns() throws SQLException(Code) | | Reset any mapped columns (e.g. in case a column is added or deleted)
|
setColumn | public void setColumn(Column column)(Code) | | Convenience method for setting single column constraints.
|
setDeferrable | public void setDeferrable(int def)(Code) | | Set the deferrable flags
|
setGlobal | public void setGlobal(boolean g)(Code) | | Set the 'global' flag
|
setName | public void setName(String name)(Code) | | Set the constraint's name
|
setRefSpec | public void setRefSpec(int ref)(Code) | | Set the referential integrity flags
|
toString | public String toString()(Code) | | Return a displayable representation for debugging
|
|
|