DELETE FROM in Delphi EX2 with SQLite3 silently failing

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

BytePlayer
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 21.09.2012, 10:13

DELETE FROM in Delphi EX2 with SQLite3 silently failing

Postby BytePlayer » 29.09.2012, 20:26

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?

User avatar
EgonHugeist
Zeos Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Postby EgonHugeist » 29.09.2012, 21:08

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....
King regards, Michael

You want to help? viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image

BytePlayer
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 21.09.2012, 10:13

Postby BytePlayer » 29.09.2012, 21:56

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.


Return to “ZeosLib 7.0 Beta Forum”

Who is online

Users browsing this forum: No registered users and 1 guest