You are not logged in.
Pages: 1
I wanted to replace
1)ADatabase.Delete (TSQLField, FIDS [i]);
with
2)ADatabase.BatchDelete (FIDS [i]);
but I have not figured out how do I delete table relationships TSQLField with TSQLQvw? (AQvw.Fields)
I have to do a cycle and delete one at a time?
if ADatabase.TransactionBegin(TSQLField) then
begin
ADatabase.BatchStart(TSQLField);
for I := 0 to Length(fIds) - 1 do
begin
if not (Progress.fCancel) then
begin
// ADatabase.Delete(TSQLField,fIds[i]);
ADatabase.BatchDelete(fIds[i]);
AQvw.Fields.ManyDelete(ADatabase, AQvw.ID, fIds[i]);
Progress.Position := i;
end
else
begin
ADatabase.BatchAbort;
ADatabase.RollBack;
exit;
end;
end;
ADatabase.BatchSend(Results);
ADatabase.Commit;
end;
Thanks corchi
Offline
please help? how to use manydelete in a batch
Offline
There is no batch version of the ManyDelete method (yet).
You'll have to call ManyDelete multiple times, but you should not mix it with BatchDelete/BatchSend commands, because batch deletions are performed only on BatchSend.
Offline
I imagined it, but i have one table and more relations and anywhere i delete the record i must to remeber to delete all relations connected to the record.
You know a better way to delete a record and all relationships without having to cycle all the records one by one?
thanks
Offline
There is a "procedure/function" that erases all the relationships are no longer valid?
How to delete a record in one table and automatically to delete all the relationships of same record?
Thanks corchi
Offline
Hello,
I am also curious to the answer on the question above.
in code below, a cascaded delete as defined in the database does not work...
bRC:=Database.Delete(TSQLPatients, iID);
While when deleting the record in a database tool, the cascaded delete works fine... how come?
Regards,
Maurijn
Offline
I've added an aUseBatchMode optional parameter to TSQLRecordMany.ManyDelete() method.
See http://synopse.info/fossil/info/c0c4838f26
It may help you calling ManyDelete() within a BATCH sequence.
Thanks for the feedback.
Offline
Pages: 1