![]() |
Quadcap Embeddable Database |
Inheritance diagram for com.quadcap.sql.Constraint:

Constraint checking hooks are available for both before and after table-modifying operations.
Definition at line 61 of file Constraint.java.
Public Member Functions | |
| Constraint () | |
| Default constructor. | |
| Constraint (String name) | |
| Construct a named constraint. | |
| Constraint (String name, Vector colNames) | |
| Construct a named constraint with a list of columns. | |
| String | getName () |
| Return the constraint's name. | |
| void | setName (String name) |
| Set the constraint's name. | |
| int | getRefAction (int opType) |
| Get the referential action for the specified operation (UPD OR DEL). | |
| String | getRefActionString (int opType) |
| Return the referential action for the specified operation. | |
| void | setGlobal (boolean g) |
| Set the 'global' flag. | |
| boolean | isGlobal () |
| Get the 'global' flag. | |
| abstract 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. | |
| abstract 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. | |
| abstract 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. | |
| abstract 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. | |
| abstract 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. | |
| abstract 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. | |
| abstract void | delete (Session session) throws SQLException, IOException |
| Called when the constraint itself is being removed. | |
| abstract void | add (Session session) throws SQLException, IOException |
| Called when the constraint is added. | |
| void | undoAdd (Session session) throws SQLException, IOException |
| Called to undo a constraint-add operation. | |
| void | undoDelete (Session session) throws SQLException, IOException |
| Called to undo a constraint-add operation. | |
| void | setDeferrable (int def) |
| Set the deferrable flags. | |
| void | setRefSpec (int ref) |
| Set the referential integrity flags. | |
| void | setTable (Table table) throws SQLException |
| Set the contstraint's table. | |
| Table | getTable () |
| Get the constraint's table. | |
| int | getSpec () |
| Return the referential integrity and deferrability flags. | |
| void | setColumn (Column column) |
| Convenience method for setting single column constraints. | |
| Column | getColumn () throws SQLException |
| For the simple, single column constraint, the constraint's column. | |
| int | getColumnCount () |
| Return the number of columns described by the constraint. | |
| Column | getColumn (int c) throws SQLException |
| Zero based!!!! | |
| void | readExternal (ObjectInput in) throws IOException, ClassNotFoundException |
| Read me from a stream. | |
| void | writeExternal (ObjectOutput out) throws IOException |
| Write me to a stream. | |
| int[] | getColumns () throws SQLException |
| Return the integer indexes in the table's column list of the columns in this constraint. | |
| void | resetColumns () throws SQLException |
| Reset any mapped columns (e.g. | |
| Vector | getColumnNames () throws SQLException |
| Return a vector containing all of the column names. | |
| Btree | getIndex (Database db) throws IOException |
| Funny, but a lot of constraints have indexes. | |
| int | getPriority () |
| Higher priority (larger numbers) execute first. | |
| boolean | isDeferred () |
| Is this constraint 'deferred'? | |
| String | toString () |
| Return a displayable representation for debugging. | |
Static Public Attributes | |
| final int | FULL = (1 << 0) |
| final int | PARTIAL = (1 << 1) |
| final int | NOACTION = 0 |
| final int | CASCADE = 1 |
| final int | SETNULL = 2 |
| final int | SETDEFAULT = 3 |
| final int | UPDATE = 2 |
| final int | DELETE = 4 |
| final int | DEFERRABLE = (1 << 6) |
| final int | INIT_DEFERRED = (1 << 7) |
| final int | GLOBAL = (1 << 8) |
Package Attributes | |
| transient Table | table |
| transient int[] | columns |
| Vector | colNames = new Vector() |
| String | name = null |
| int | spec = 0 |
Static Package Attributes | |
| String[] | refActions |
| String names for Various referential actions. | |
|
|
Default constructor.
Definition at line 93 of file Constraint.java. |
|
|
Construct a named constraint.
Definition at line 98 of file Constraint.java. |
|
||||||||||||
|
Construct a named constraint with a list of columns.
Definition at line 105 of file Constraint.java. |
|
|
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) Implemented in com.quadcap.sql.AutoNumberConstraint, com.quadcap.sql.CheckConstraint, com.quadcap.sql.ForeignKeyConstraint, com.quadcap.sql.ImportedKeyConstraint, com.quadcap.sql.IndexConstraint, and com.quadcap.sql.NotNullConstraint. Referenced by com.quadcap.sql.AddConstraint.redo(). |
|
||||||||||||||||||||
|
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. Implemented in com.quadcap.sql.AutoNumberConstraint, com.quadcap.sql.CheckConstraint, com.quadcap.sql.ForeignKeyConstraint, com.quadcap.sql.ImportedKeyConstraint, com.quadcap.sql.IndexConstraint, and com.quadcap.sql.NotNullConstraint. Referenced by com.quadcap.sql.TableOps.deleteRow(). |
|
||||||||||||||||||||
|
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 Implemented in com.quadcap.sql.AutoNumberConstraint, com.quadcap.sql.CheckConstraint, com.quadcap.sql.ForeignKeyConstraint, com.quadcap.sql.ImportedKeyConstraint, com.quadcap.sql.IndexConstraint, and com.quadcap.sql.NotNullConstraint. |
|
||||||||||||||||||||||||||||
|
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. Implemented in com.quadcap.sql.AutoNumberConstraint, com.quadcap.sql.CheckConstraint, com.quadcap.sql.ForeignKeyConstraint, com.quadcap.sql.IndexConstraint, and com.quadcap.sql.NotNullConstraint. Referenced by com.quadcap.sql.TableOps.updateRow(). |
|
||||||||||||||||
|
----DELETE Called before a row is DELETED, with an opportunity to signal a constraint violation if one can be detected.
Implemented in com.quadcap.sql.AutoNumberConstraint, com.quadcap.sql.CheckConstraint, com.quadcap.sql.ExportedKeyConstraint, com.quadcap.sql.ForeignKeyConstraint, com.quadcap.sql.IndexConstraint, and com.quadcap.sql.NotNullConstraint. Referenced by com.quadcap.sql.TableOps.deleteRow(). |
|
||||||||||||
|
---INSERT Called before a row is INSERTED, with an opportunity to signal a constraint violation if one can be detected.
Implemented in com.quadcap.sql.AutoNumberConstraint, com.quadcap.sql.CheckConstraint, com.quadcap.sql.ForeignKeyConstraint, com.quadcap.sql.ImportedKeyConstraint, com.quadcap.sql.IndexConstraint, com.quadcap.sql.NonUniqueIndexConstraint, com.quadcap.sql.NotNullConstraint, and com.quadcap.sql.UniqueConstraint. |
|
||||||||||||||||||||||||||||
|
----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. Implemented in com.quadcap.sql.AutoNumberConstraint, com.quadcap.sql.CheckConstraint, com.quadcap.sql.ExportedKeyConstraint, com.quadcap.sql.ImportedKeyConstraint, com.quadcap.sql.IndexConstraint, and com.quadcap.sql.NotNullConstraint. Referenced by com.quadcap.sql.TableOps.updateRow(). |
|
|
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. Implemented in com.quadcap.sql.AutoNumberConstraint, com.quadcap.sql.CheckConstraint, com.quadcap.sql.ExportedKeyConstraint, com.quadcap.sql.ForeignKeyConstraint, com.quadcap.sql.ImportedKeyConstraint, com.quadcap.sql.IndexConstraint, and com.quadcap.sql.NotNullConstraint. Referenced by com.quadcap.sql.DeleteConstraint.redo(). |
|
|
Zero based!!!!
Definition at line 331 of file Constraint.java. References com.quadcap.sql.Constraint.columns, com.quadcap.sql.TupleImpl.getColumn(), and com.quadcap.sql.Constraint.table. |
|
|
For the simple, single column constraint, the constraint's column.
Definition at line 312 of file Constraint.java. References com.quadcap.sql.Constraint.columns, com.quadcap.sql.TupleImpl.getColumn(), com.quadcap.sql.Constraint.getColumns(), and com.quadcap.sql.Constraint.table. Referenced by com.quadcap.sql.AutoNumberConstraint.add(), com.quadcap.sql.AutoNumberConstraint.checkInsert(), com.quadcap.sql.AutoNumberConstraint.delete(), com.quadcap.sql.meta.MetaBestRowId.MetaBestRowId(), and com.quadcap.sql.SelectExpression.optimizeAggregate(). |
|
|
Return the number of columns described by the constraint.
Definition at line 324 of file Constraint.java. References com.quadcap.sql.Constraint.colNames. Referenced by com.quadcap.sql.UniqueConstraint.getIndexColumnCount(), com.quadcap.sql.PrimaryKeyConstraint.getIndexColumnCount(), com.quadcap.sql.NonUniqueIndexConstraint.getIndexColumnCount(), com.quadcap.sql.IndexConstraint.getIndexColumnCount(), and com.quadcap.sql.meta.MetaBestRowId.MetaBestRowId(). |
|
|
Return a vector containing all of the column names.
Definition at line 379 of file Constraint.java. References com.quadcap.sql.Constraint.colNames. Referenced by com.quadcap.sql.Table.getIndexConstraint(), com.quadcap.sql.IndexCursor.IndexCursor(), and com.quadcap.sql.IndexConstraint.toString(). |
|
|
|
Funny, but a lot of constraints have indexes. For the ones that do, this can be a nifty little function. Reimplemented in com.quadcap.sql.ImportedKeyConstraint, and com.quadcap.sql.IndexConstraint. Definition at line 387 of file Constraint.java. References com.quadcap.sql.Constraint.getIndex(). Referenced by com.quadcap.sql.ModIndexEntry.getIndex(), com.quadcap.sql.Constraint.getIndex(), and com.quadcap.sql.UpdateIndex.UpdateIndex(). |
|
|
|
Higher priority (larger numbers) execute first.
Reimplemented in com.quadcap.sql.AutoNumberConstraint. Definition at line 394 of file Constraint.java. Referenced by com.quadcap.sql.Table.addConstraint(), and com.quadcap.sql.Column.addConstraint(). |
|
|
Get the referential action for the specified operation (UPD OR DEL).
Definition at line 127 of file Constraint.java. References com.quadcap.sql.Constraint.getRefAction(), and com.quadcap.sql.Constraint.spec. Referenced by com.quadcap.sql.ExportedKeyConstraint.checkKeyRemoval(), and com.quadcap.sql.Constraint.getRefAction(). |
|
|
Return the referential action for the specified operation.
Definition at line 140 of file Constraint.java. References com.quadcap.sql.Constraint.getRefActionString(), and com.quadcap.sql.Constraint.refActions. Referenced by com.quadcap.sql.Constraint.getRefActionString(). |
|
|
Return the referential integrity and deferrability flags.
Definition at line 292 of file Constraint.java. References com.quadcap.sql.Constraint.spec. |
|
|
Get the constraint's table.
Definition at line 287 of file Constraint.java. Referenced by com.quadcap.sql.JoinInnerCursor.findIndex(), and com.quadcap.sql.ModIndexEntry.writeExternal(). |
|
|
Is this constraint 'deferred'?
Reimplemented in com.quadcap.sql.ForeignKeyConstraint. Definition at line 399 of file Constraint.java. Referenced by com.quadcap.sql.IndexConstraint.applyUpdate(). |
|
|
Get the 'global' flag.
Definition at line 158 of file Constraint.java. References com.quadcap.sql.Constraint.GLOBAL, and com.quadcap.sql.Constraint.spec. Referenced by com.quadcap.sql.DeleteConstraint.redo(), and com.quadcap.sql.DeleteConstraint.undo(). |
|
|
|
Reset any mapped columns (e.g. in case a column is added or deleted) Reimplemented in com.quadcap.sql.ForeignKeyConstraint. Definition at line 372 of file Constraint.java. References com.quadcap.sql.Constraint.columns. Referenced by com.quadcap.sql.IndexConstraint.add(), com.quadcap.sql.StmtDropColumn.deleteColumnConstraints(), and com.quadcap.sql.Table.resetColumnConstraints(). |
|
|
Convenience method for setting single column constraints.
Definition at line 299 of file Constraint.java. References com.quadcap.sql.Constraint.colNames, com.quadcap.sql.Column.getName(), and com.quadcap.sql.Constraint.setColumn(). Referenced by com.quadcap.sql.Table.addColumn(), com.quadcap.sql.Column.addConstraint(), and com.quadcap.sql.Constraint.setColumn(). |
|
|
Set the deferrable flags.
Definition at line 264 of file Constraint.java. References com.quadcap.sql.Constraint.setDeferrable(). Referenced by com.quadcap.sql.SQLParser.columnConstraint(), and com.quadcap.sql.Constraint.setDeferrable(). |
|
|
Set the 'global' flag.
Definition at line 147 of file Constraint.java. References com.quadcap.sql.Constraint.GLOBAL, com.quadcap.sql.Constraint.setGlobal(), and com.quadcap.sql.Constraint.spec. Referenced by com.quadcap.sql.StmtCreateIndex.execute(), and com.quadcap.sql.Constraint.setGlobal(). |
|
|
Set the constraint's name.
Definition at line 120 of file Constraint.java. References com.quadcap.sql.Constraint.setName(). Referenced by com.quadcap.sql.Table.nameConstraint(), and com.quadcap.sql.Constraint.setName(). |
|
|
Set the referential integrity flags.
Definition at line 271 of file Constraint.java. References com.quadcap.sql.Constraint.setRefSpec(). Referenced by com.quadcap.sql.SQLParser.columnConstraint(), com.quadcap.sql.Constraint.setRefSpec(), and com.quadcap.sql.SQLParser.tableConstraint(). |
|
|
Set the contstraint's table.
Reimplemented in com.quadcap.sql.NotNullConstraint, and com.quadcap.sql.PrimaryKeyConstraint. Definition at line 278 of file Constraint.java. References com.quadcap.sql.TupleImpl.columns, com.quadcap.sql.Constraint.getColumns(), com.quadcap.sql.Constraint.setTable(), and com.quadcap.sql.Constraint.table. Referenced by com.quadcap.sql.Table.addConstraint(), com.quadcap.sql.StmtDropConstraint.execute(), com.quadcap.sql.StmtCreateIndex.execute(), com.quadcap.sql.AddConstraint.prepare(), com.quadcap.sql.Table.readExternal(), com.quadcap.sql.DeleteConstraint.redo(), and com.quadcap.sql.Constraint.setTable(). |
|
|
Return a displayable representation for debugging.
Reimplemented in com.quadcap.sql.DefaultTableConstraint, com.quadcap.sql.ForeignKeyConstraint, com.quadcap.sql.IndexConstraint, and com.quadcap.sql.NonUniqueIndexConstraint. Definition at line 406 of file Constraint.java. References com.quadcap.sql.Constraint.colNames, com.quadcap.sql.Constraint.DEFERRABLE, com.quadcap.sql.Constraint.DELETE, com.quadcap.sql.Constraint.FULL, com.quadcap.sql.TupleImpl.getName(), com.quadcap.sql.Constraint.INIT_DEFERRED, com.quadcap.sql.Constraint.name, com.quadcap.sql.Constraint.NOACTION, com.quadcap.sql.Constraint.PARTIAL, com.quadcap.sql.Constraint.spec, com.quadcap.sql.Constraint.table, and com.quadcap.sql.Constraint.UPDATE. Referenced by com.quadcap.sql.DeleteConstraint.toString(), and com.quadcap.sql.AddConstraint.toString(). |
|
|
Called to undo a constraint-add operation.
Definition at line 245 of file Constraint.java. References com.quadcap.sql.Constraint.undoAdd(). Referenced by com.quadcap.sql.AddConstraint.undo(), and com.quadcap.sql.Constraint.undoAdd(). |
|
|
Called to undo a constraint-add operation.
Reimplemented in com.quadcap.sql.CheckConstraint. Definition at line 254 of file Constraint.java. References com.quadcap.sql.Constraint.undoDelete(). Referenced by com.quadcap.sql.DeleteConstraint.undo(), and com.quadcap.sql.Constraint.undoDelete(). |
|
|
|
Definition at line 74 of file Constraint.java. |
|
|
|
Definition at line 63 of file Constraint.java. Referenced by com.quadcap.sql.Constraint.getColumn(), com.quadcap.sql.Constraint.getColumns(), com.quadcap.sql.Constraint.readExternal(), and com.quadcap.sql.Constraint.resetColumns(). |
|
|
Definition at line 84 of file Constraint.java. Referenced by com.quadcap.sql.Constraint.toString(). |
|
|
Definition at line 81 of file Constraint.java. Referenced by com.quadcap.sql.Constraint.toString(). |
|
|
Definition at line 69 of file Constraint.java. Referenced by com.quadcap.sql.Constraint.toString(). |
|
|
Definition at line 88 of file Constraint.java. Referenced by com.quadcap.sql.Constraint.isGlobal(), and com.quadcap.sql.Constraint.setGlobal(). |
|
|
Definition at line 86 of file Constraint.java. Referenced by com.quadcap.sql.Constraint.toString(). |
|
|
Definition at line 65 of file Constraint.java. Referenced by com.quadcap.sql.Constraint.getName(), com.quadcap.sql.Constraint.readExternal(), com.quadcap.sql.Constraint.toString(), and com.quadcap.sql.Constraint.writeExternal(). |
|
|
Definition at line 73 of file Constraint.java. Referenced by com.quadcap.sql.Constraint.toString(). |
|
|
Definition at line 70 of file Constraint.java. Referenced by com.quadcap.sql.Constraint.toString(). |
|
|
Initial value: String names for Various referential actions.
Definition at line 134 of file Constraint.java. Referenced by com.quadcap.sql.Constraint.getRefActionString(). |
|
|
Definition at line 76 of file Constraint.java. |
|
|
Definition at line 75 of file Constraint.java. |
|
|
|
Definition at line 62 of file Constraint.java. Referenced by com.quadcap.sql.Constraint.getColumn(), com.quadcap.sql.Constraint.getColumns(), com.quadcap.sql.DeleteConstraint.redo(), com.quadcap.sql.Constraint.setTable(), and com.quadcap.sql.Constraint.toString(). |
|
|
Definition at line 79 of file Constraint.java. Referenced by com.quadcap.sql.Constraint.toString(). |