S
Sander Verhagen
Hi,
For implementation in VC/MFC I'm using CDaoDatabase and will soon convert to
CDatabase.
I want to provide functionality in my database layer to insert a combination
of database records into the database that only all together meet
referential integrity validation rules. Thus with loops where table A
records have a foreign key to table B and vice versa. I'll leave out the
actual examples, as I don't want to start a discussion on that. Let's please
just assume there are good reasons for this kind of modeling.
Also I want to strongly enforce referential integrity in my database, thus I
am defining that relations must be valid and key fields are required.
Inserting A without the referenced field in B yet existing will lead to an
error from the database. The other way around just the same. A loop
situation occurs.
Is there a way to postpone this validation?
I have tried doing all the mentioned inserts from within a single
transaction; but it is still validating the individual inserts. Is there a
way around that?
(I know there are workarounds, such as having a dummy field to reference and
replacing the reference once the actual record exists and such. But I don't
see these as anything else but nasty tricks, while I am looking for an
actual solution. I see a solution in postponing the validation, as said, but
I don't know how to do that.)
Help!
Thanks already,
Sander Verhagen
[ (e-mail address removed) ]
For implementation in VC/MFC I'm using CDaoDatabase and will soon convert to
CDatabase.
I want to provide functionality in my database layer to insert a combination
of database records into the database that only all together meet
referential integrity validation rules. Thus with loops where table A
records have a foreign key to table B and vice versa. I'll leave out the
actual examples, as I don't want to start a discussion on that. Let's please
just assume there are good reasons for this kind of modeling.
Also I want to strongly enforce referential integrity in my database, thus I
am defining that relations must be valid and key fields are required.
Inserting A without the referenced field in B yet existing will lead to an
error from the database. The other way around just the same. A loop
situation occurs.
Is there a way to postpone this validation?
I have tried doing all the mentioned inserts from within a single
transaction; but it is still validating the individual inserts. Is there a
way around that?
(I know there are workarounds, such as having a dummy field to reference and
replacing the reference once the actual record exists and such. But I don't
see these as anything else but nasty tricks, while I am looking for an
actual solution. I see a solution in postponing the validation, as said, but
I don't know how to do that.)
Help!
Thanks already,
Sander Verhagen
[ (e-mail address removed) ]