Check constraint (and other constraints) are already added to Dabase as
DbObjects.
Eg.
AlterTableAddConstraint.java
line 241: db.addSchemaObject(session, constraint);
But it is also added to table
line 243: table.addConstraint(constraint);
If it is defined for column it is associated with a Column in Parser
line 5261: column.addCheckConstraint(session, expr);
So basically my current idea would be to remove the check constraints
from table and column and keep them only in database.
Let's continue with the Insert example.
Insert.java
line 142: table.fire(session, Trigger.INSERT, false);
Before that we could add something like
dbConstraints = session.getDatabase().getAffectedConstraints(table,
<list_of_changed_columns>);
for(dbc : dbConstraints) {
dbc.checkExistingData(session); // Implementation in
ConstraintCheck.java needs to be modified because it assumes that it
operates only on single table
}
All insight is much appreciated because I am still a bit overwhelmed by
all the code and it's mysterious ways.
(Parser must be the longest java file I have seen with 5379 lines :)
- Rami
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.