Hello,
Here is a quick fix for a bug in the TZSQLiteStatement.Execute() routine. If an empty SQL string is passed into the function it will raise a cryptic error message:
"library routine called out of sequence"
Replace this:
CheckSQLiteError(FPlainDriver, ErrorCode, ErrorMessage, lcExecute, SQL);
DriverManager.LogMessage(lcExecute, FPlainDriver.GetProtocol, SQL);
try
ErrorCode := FPlainDriver.Step(StmtHandle, ColumnCount,
with this:
CheckSQLiteError(FPlainDriver, ErrorCode, ErrorMessage, lcExecute, SQL);
DriverManager.LogMessage(lcExecute, FPlainDriver.GetProtocol, SQL);
ColumnCount := 0;
if SQL <> '' then
try
ErrorCode := FPlainDriver.Step(StmtHandle, ColumnCount,
... in the referred routine.
Can anyone else please confirm this works ?
Thanks,
Howe
Fix for SQLite's TZUpdateSQL binding bug on v6.6.1 - beta
Moderators: gto, cipto_kh, EgonHugeist
The real reason why it is not working is because it is a general bug. It can be (temporarely) solved by:
You'll find it in ZAbstractRODataset
albert
Code: Select all
{**
Checks the correct SQL query.
}
procedure TZAbstractRODataset.CheckSQLQuery;
begin
if Trim(FSQL.Text)='' then // 20070529 Aducom
raise EZSQLException.Create(SQueryIsEmpty); // 20070529 Aducom
if FSQL.StatementCount < 1 then
raise EZDatabaseError.Create(SQueryIsEmpty);
if FSQL.StatementCount > 1 then
raise EZDatabaseError.Create(SCanNotExecuteMoreQueries);
end;
albert
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
I just committed a more correct solution (SVN rev. 256). Now FSQL.statementcount correctly returns 0 when the query string is empty. This had some implications on other components too. So the patch was a little more complicated. It will be in next 'Testing' snapshot. Meanwhile you can solve it as above.
Mark
Mark