Next doesn't work in Android Arm v7a
Posted: 27.10.2024, 21:42
I successfully use Zeos with LAMW (FPC 3.2.2) and Sqlite for Android Aarch64 target (using binaries for Android from sqlite.org).
But when target is ARM v7a (armeabi), 'Next' and 'Prior' methods of TZQuery doesn't work. 'First' and 'Last' does work (correction: Last does something, but not exactly what is expected).
I use Zeos version 7.2.4, but I also tried with 8.0.0. stable and current trunk.
I tried several Sqlite versions, from 3.47.0 to 3.25.0.
I create table and test data with:
Then I test with following code:
And this is result:
This are expected results (I got this with Aarch64 target):
Does anybody have clue what could be culprit?
Thank you.
P.S.: I will also post this in Freepascal forum and report here if somebody there has a solution.
But when target is ARM v7a (armeabi), 'Next' and 'Prior' methods of TZQuery doesn't work. 'First' and 'Last' does work (correction: Last does something, but not exactly what is expected).
I use Zeos version 7.2.4, but I also tried with 8.0.0. stable and current trunk.
I tried several Sqlite versions, from 3.47.0 to 3.25.0.
I create table and test data with:
Code: Select all
SQL.Text :=
'create table if not exists mytable ' +
'(' +
'id integer not null, ' +
'value integer, ' +
'primary key (id)' +
')';
ExecSQL;
SQL.Text := 'insert into mytable (id, value) values (1, 100)';
ExecSQL;
SQL.Text := 'insert into mytable (id, value) values (2, 200)';
ExecSQL;
SQL.Text := 'insert into mytable (id, value) values (3, 300)';
ExecSQL;
Code: Select all
procedure TAndroidModule1.btnNextTestClick(Sender: TObject);
var i: Integer;
procedure PrintLine(const AText: String);
var sEOF: String;
begin
If ZQry.EOF then
sEOF := 'true'
else
sEOF := 'false';
edLog.Append(
AText + ': ID = ' + ZQry.FieldByName('id').AsString +', value = ' +
ZQry.FieldByName('value').AsString + ', RecNo: ' + ZQry.RecNo.ToString +
', EOF: ' + sEOF + #13#10);
end;
begin
With ZQry do
begin
Close;
SQL.Text := 'select count(*) from mytable';
Open;
edLog.Append('Count: ' + IntToStr(Fields[0].AsInteger) + #13#10);
Close;
SQL.Text := 'select id, value from mytable';
Open;
i := 0;
While (not Eof) and (i < 5) do
begin
inc(i);
PrintLine('Loop ' + i.ToString);
Next;
end;
Last;
PrintLine('Last');
Prior;
PrintLine('Prior');
First;
PrintLine('First');
end;
end;
Code: Select all
Count: 3
Loop 1: ID = 1, value = 100, RecNo: 1, EOF: false
Loop 2: ID = 1, value = 100, RecNo: 1, EOF: false
Loop 3: ID = 1, value = 100, RecNo: 1, EOF: false
Loop 4: ID = 1, value = 100, RecNo: 1, EOF: false
Loop 5: ID = 1, value = 100, RecNo: 1, EOF: false
Last: ID = , value = , RecNo: 4, EOF: true
Prior: ID = , value = , RecNo: 4, EOF: true
First: ID = 1, value = 100, RecNo: 1, EOF: false
Code: Select all
Count: 3
Loop 1: ID = 1, value = 100, RecNo: 1, EOF: false
Loop 2: ID = 2, value = 200, RecNo: 2, EOF: false
Loop 3: ID = 3, value = 300, RecNo: 3, EOF: false
Last: ID = 3, value = 300, RecNo: 3, EOF: true
Prior: ID = 2, value = 200, RecNo: 2, EOF: false
First: ID = 1, value = 100, RecNo: 1, EOF: false
Thank you.
P.S.: I will also post this in Freepascal forum and report here if somebody there has a solution.