Hi,
I'm using FPC including SQLite using the TSqlite3Dataset component, connection and selecting works mainly.
But only for strings and integers.
If I want to get boolean it's everytime false,
if I want to get DateTime it's everytime the 12/31/1899.
The code:
procedure SQLiteQuery(var DS: TSqlite3Dataset);
begin
with DS do
begin
SQL := 'SELECT SimpleDate, SimpleBoolean FROM simpletest';
Open;
First;
end;
end;
function SQLiteFetch(DS: TSqlite3Dataset): TLine;
begin
with DS do
begin
Result.SimpleDate := Fields[0].AsDateTime;
Result.SimpleBoolean := Fields[1].AsBoolean;
Next;
end;
end;
procedure SimpleTest;
var
i: integer;
line: TLine;
begin
// DB is the TSqlite3Dataset component
SQLiteQuery(DB);
for i := 0 to DB.RecordCount-1 do
begin
line := SQLiteFetch(DB);
ShowMessage(DateToStr(line.SimpleDate));
if(line.SimpleBoolean) then ShowMessage('true') else ShowMessage('false');
end;
end;
It's out of a program, but I have cuted it so, that only the important is pastet here.
greetings,
Schaelle