how to persist master-detail tables in a single transaction?
Posted: 27.08.2013, 14:34
Hello,
I'm trying to get the next insertion ID of the master table to put it to the detail's MasterFK field and persist both of the tables in one single commit. How can I accomplish this?
What I tried to do is something like
ZConnection options:
AutoCommit = FALSE
TransactionIsolationLevel = tiReadCommitted
ZQuery options:
CachedUpdates = TRUE
ZQuery1Field1.Value := Edit1.Text;
ZQuery1.ApplyUpdates;
ZQuery2MasterFK.Value := ZQuery1Id.Value;
ZQuery2Field1.Value := Edit2.Text;
ZQuery2.ApplyUpdates;
ZConnection1.Commit;
I'm trying to get the next insertion ID of the master table to put it to the detail's MasterFK field and persist both of the tables in one single commit. How can I accomplish this?
What I tried to do is something like
ZConnection options:
AutoCommit = FALSE
TransactionIsolationLevel = tiReadCommitted
ZQuery options:
CachedUpdates = TRUE
ZQuery1Field1.Value := Edit1.Text;
ZQuery1.ApplyUpdates;
ZQuery2MasterFK.Value := ZQuery1Id.Value;
ZQuery2Field1.Value := Edit2.Text;
ZQuery2.ApplyUpdates;
ZConnection1.Commit;