DELETE FROM in Delphi EX2 with SQLite3 silently failing
Posted: 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?
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?