Convert ADO SQL to Zeos using SQLite

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
kbboykin
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 05.11.2020, 14:43

Convert ADO SQL to Zeos using SQLite

Post by kbboykin »

What is the best way to convert this query from ado to zeos. I am using Delphi 2010 and SQLite.

Code: Select all

select * from course where startdate >= now order by startdate
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1962
Joined: 17.01.2011, 14:17

Re: Convert ADO SQL to Zeos using SQLite

Post by marsupilami »

Hello,

generally the SQL statements stay the same. There may be differences, when it comes to parameters. I seem to remember that the Delphi ADO components don't support named parameters. So the implementation probably looks like this:

Code: Select all

ZeosQuery.Close;
ZeosQuery.SQL.Text := 'select * from course where startdate >= now order by startdate';
ZeosQuery.Open;
If you you want to feed "now" to the query as a parameter, it could look something like this:

Code: Select all

ZeosQuery.Close;
ZeosQuery.SQL.Text := 'select * from course where startdate >= :MyParamStartDate order by startdate';
ZeosQuery.ParamByName('MyParamStartDate').AsDateTime := Date;
ZeosQuery.Open;
Note: This code is liable to break in one way or another - sqlite has no support for dates, id I remember correctly.

Best regards,

Jan
Post Reply