Subject | Re: [Firebird-Java] Re: How to turn referential integrity checking off |
---|---|
Author | Roman Rokytskyy |
Post date | 2005-10-01T07:18:29Z |
> Yes, the deferred constraint checks describe definitely better what II think you mean that data in the tables do not exist, not the tables
> have to do. My purpose is to find a way to populate a target Firebird
> database without having problems with referenced tables that still do
> not exist (because they're still not written to the database at that
> point in time).
themselves. Right?
>> The talk is about a global switch that triggers all constrainsYup, but this functionality does not exist, as well as the deferred
>> inactive without a need to walk through all system tables and
>> deactivating each constraint separately.
>
> That will also suit my purpose: turn all constraints off, populate the
> Firebird database without complaints about references to nonexistent
> table columns, then turn the checks on as they have initially been.
constraint checking.
> As far as I could understand, one suggestion to do this is to drop allYou have to code it yourself. You can walk through all tables, get their
> constraints and then create them anew. Is there a way to protocol the
> existent constraints somewhere before dropping them?
constraints with DatabaseMetaData call (getImportedKeys and
getExportedKeys), store somewhere, and at the end construct appropriate SQL
statements.
> What kind of switch is it?-N or -NO_VALIDITY
> Could you please tell me if I can find the source code for the gbak.exeThat is either firebird2/src/burp for Firebird 1.5 and 2.0 code base or
> somewhere in the CVS repository:
> http://cvs.sourceforge.net/viewcvs.py/firebird/ in order to have a look?
interbase/burp for Firebird 1.0 code base. BURP means BackUp and Restore
Protocol(?). But if I understand correctly, that won't help you much, since
the approach there is a bit different. When gbak creates a backup file, it
stores the constraints separately as ALTER TABLE ... ADD CONSTRAINT
statements (sure, that are not direct SQL statements, but something
similar). So, during restore the switch tells simply to ignore the
constraint restoration.
Roman