Subject Re: [firebird-support] Referential Integrity
Author Milan Babuskov
Steve Harp wrote:
> I think I know the answer to this one but I'll ask anyway. Is there a
> way to turn off referential integrity within a transaction so that you
> can make sweeping changes that may temporarily voilate referential
> integrity?

Within transaction: no. But you could turn it off completely. Since you
probably don't want to do that, so you may want to consider something
else...

> I have a Paradox table that I need to sync with a table in the
> Firebird database using unique ID fields. The tables contain fields,
> Name and ItemCode that are unique in both tables but may not point to
> the same IDs. I'd like to sweep through the Paradox table and update
> each record (based on it's ID)

"Based on it's ID?", or rather "based on Name+ItemCode pair"? I'm not
sure I understand the problem.

> in the Firebird table so that the ID,
> Name, and ItemCode fields all match in both tables.

I don't see why do you need to turn ref. integrity off here? If I
understand correctly you have one table FB and one in Pdox.

FB:
ID, Name, ItemCode
1 a 123
2 a 124

Pdox:
ID, Name, ItemCode
1 a 123
6 a 124

And you want to have (in both FB and Pdox):

ID, Name, ItemCode
1 a 123
2 a 124
6 a 124

Right?


Or perhaps you want to have:

ID, Name, ItemCode
1 a 123
6 a 124

in both?

Whatever is the case, I don't see why ref.integrity would fail. You
could simply declare all foreign keys WITH UPDATE CASCADE and be done
with it.

--
Milan Babuskov
http://www.flamerobin.org