I have a SQLite3 Database and have set the tzConnection to auto-commit but when I run the following procedure it does nothing to the table, the record count remains unchanged.
procedure EmptyTable(inTable:tzTable);
begin
MyQuery:=tzQuery.Create(nil)
MyQuery.Connection := inTable.Connection;
MyQuery.SQL.Text := 'DELETE FROM '+inTable.TableName ;
MyQuery.ExecSQL;
MyQuery.free;
if inTable.RecordCount > 0 then
Raise Exception.Create('DELETE FROM '+inTable.TableName+' Failed';
end;
Everything APPEARS to work without an error but then RecordCount remains unchanged and it always throws the exception.
What could I possibly be doing wrong?
DELETE FROM in Delphi EX2 with SQLite3 silently failing
Moderators: gto, EgonHugeist, olehs
-
- Fresh Boarder
- Posts: 24
- Joined: 21.09.2012, 10:13
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
BytePlayer,
how can InTable know that a second query was dropping the rows? Refresh/reopen inTable first and then everything is fine. The TZDataSet Components are cached(the SQLite protocol is forward_only and fetches all rows before closing the stmt handle) so if MyQuery deletes the data of inTable.TableName then InTables can't know this....
how can InTable know that a second query was dropping the rows? Refresh/reopen inTable first and then everything is fine. The TZDataSet Components are cached(the SQLite protocol is forward_only and fetches all rows before closing the stmt handle) so if MyQuery deletes the data of inTable.TableName then InTables can't know this....
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
-
- Fresh Boarder
- Posts: 24
- Joined: 21.09.2012, 10:13
Okay, I'll give that a shot!
Thanks for the quick feedback.
Also, slightly off topic, but where is the best documentation for the Zeoslib components? There are quite a number of components, like Sequencers, that I haven't run into before but I can't find a good explanation of what they are used for.
Thanks for the quick feedback.
Also, slightly off topic, but where is the best documentation for the Zeoslib components? There are quite a number of components, like Sequencers, that I haven't run into before but I can't find a good explanation of what they are used for.