Recent

Author Topic: Next doesn't work in Android Arm v7a  (Read 347 times)

dseligo

  • Hero Member
  • *****
  • Posts: 1443
Next doesn't work in Android Arm v7a
« on: October 27, 2024, 09:49:58 pm »
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:
Code: Pascal  [Select][+][-]
  1. SQL.Text :=
  2.   'create table if not exists mytable ' +
  3.   '(' +
  4.   'id integer not null, ' +
  5.   'value integer, ' +
  6.   'primary key (id)' +
  7.   ')';
  8. ExecSQL;
  9.  
  10. SQL.Text := 'insert into mytable (id, value) values (1, 100)';
  11. ExecSQL;
  12. SQL.Text := 'insert into mytable (id, value) values (2, 200)';
  13. ExecSQL;
  14. SQL.Text := 'insert into mytable (id, value) values (3, 300)';
  15. ExecSQL;

Then I test with following code:
Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.btnNextTestClick(Sender: TObject);
  2. var i: Integer;
  3.  
  4.   procedure PrintLine(const AText: String);
  5.   var sEOF: String;
  6.   begin
  7.     If ZQry.EOF then
  8.       sEOF := 'true'
  9.     else
  10.       sEOF := 'false';
  11.  
  12.     edLog.Append(
  13.       AText + ': ID = ' + ZQry.FieldByName('id').AsString +', value = ' +
  14.       ZQry.FieldByName('value').AsString + ', RecNo: ' + ZQry.RecNo.ToString +
  15.       ', EOF: ' + sEOF + #13#10);
  16.   end;
  17.  
  18. begin
  19.   With ZQry do
  20.   begin
  21.     Close;
  22.     SQL.Text := 'select count(*) from mytable';
  23.     Open;
  24.     edLog.Append('Count: ' + IntToStr(Fields[0].AsInteger) + #13#10);
  25.  
  26.     Close;
  27.     SQL.Text := 'select id, value from mytable';
  28.     Open;
  29.  
  30.     i := 0;
  31.     While (not Eof) and (i < 5) do
  32.     begin
  33.       inc(i);
  34.       PrintLine('Loop ' + i.ToString);
  35.       Next;
  36.     end;
  37.  
  38.     Last;
  39.     PrintLine('Last');
  40.  
  41.     Prior;
  42.     PrintLine('Prior');
  43.  
  44.     First;
  45.     PrintLine('First');
  46.   end;
  47. end;

And this is result:
Code: Text  [Select][+][-]
  1. Count: 3
  2. Loop 1: ID = 1, value = 100, RecNo: 1, EOF: false
  3. Loop 2: ID = 1, value = 100, RecNo: 1, EOF: false
  4. Loop 3: ID = 1, value = 100, RecNo: 1, EOF: false
  5. Loop 4: ID = 1, value = 100, RecNo: 1, EOF: false
  6. Loop 5: ID = 1, value = 100, RecNo: 1, EOF: false
  7. Last: ID = , value = , RecNo: 4, EOF: true
  8. Prior: ID = , value = , RecNo: 4, EOF: true
  9. First: ID = 1, value = 100, RecNo: 1, EOF: false

This are expected results (I got this with Aarch64 target):
Code: Text  [Select][+][-]
  1. Count: 3
  2. Loop 1: ID = 1, value = 100, RecNo: 1, EOF: false
  3. Loop 2: ID = 2, value = 200, RecNo: 2, EOF: false
  4. Loop 3: ID = 3, value = 300, RecNo: 3, EOF: false
  5. Last: ID = 3, value = 300, RecNo: 3, EOF: true
  6. Prior: ID = 2, value = 200, RecNo: 2, EOF: false
  7. First: ID = 1, value = 100, RecNo: 1, EOF: false

Does anybody have clue what could be culprit?

Thank you.

P.S.: I will also post this in Zeoslib portal and report here if somebody there has a solution.

 

TinyPortal © 2005-2018