Recent

Author Topic: Failed adding to JNI local ref table (has 512 entries) using jSqliteDataAccess  (Read 473 times)

Robert Gilland

  • Full Member
  • ***
  • Posts: 151
Why is this Code failing

sdamovies is a jSqliteDataAccess object connecting to a jDBListView component


I/frmMovieSearch( 5464): 20200606095823302:Calling InsertIntoTableBatch 500 movies

E/dalvikvm( 5464): JNI ERROR (app bug): local reference table overflow (max=512)

code is:
Code: Pascal  [Select][+][-]
  1.  procedure BatchProcessMovies;
  2.   var
  3.     i : Integer;
  4.     liBatchCount : Integer;
  5.     stmtArray: TDynArrayOfString;
  6.     lMovieObj : TMovieObj;
  7.     lsTableValues : String;
  8.  
  9.   begin
  10.     if( slMovies.Count > cntMaxRows )then
  11.       liBatchCount := cntMaxRows   // 500
  12.     else
  13.       liBatchCount := slMovies.Count;
  14.     SetLength(stmtArray, liBatchCount);
  15.     i := 0;
  16.     while( i < liBatchCount )do
  17.       begin
  18.         inc(liIdx);
  19.         lMovieObj     := TMovieObj( slMovies.Objects[0] );
  20.         lsTableValues := IntToStr(liIdx) + ',' +
  21.           QuotedStr(lMovieObj.DiskName) + ',' +
  22.           QuotedStr(lMovieObj.FullFileName);
  23.         lsSQL :=  'INSERT INTO MOVIES ( MOVIEID, DISKNAME, FULLFILE ) VALUES (' + lsTableValues + ')';
  24.         inc(i);
  25.         stmtArray[i] := lsSQL;
  26.         DoLog('Batch SQL: ' + lsSQL);
  27.         slMovies.Delete(0);
  28.       end;
  29.     if( liBatchCount > 0 )then
  30.       begin
  31.         DoLog('Calling InsertIntoTableBatch ' + IntToStr(liBatchCount) + ' movies');
  32.         sdamovies.InsertIntoTableBatch(stmtArray);
  33.         SetLength(stmtArray, 0);
  34.         DoLog('Called InsertIntoTableBatch');
  35.       end;
  36.   end;                                      
  37.  
« Last Edit: June 06, 2020, 12:04:15 pm by Robert Gilland »

Robert Gilland

  • Full Member
  • ***
  • Posts: 151
Now I am getting:

I/frmMovieSearch( 2265): 20200607001321448:Calling InsertIntoTableBatch 200 movies

E/SQLiteLog( 2265): (21) API called with NULL prepared statement

E/SQLiteLog( 2265): (21) misuse at line 63243 of [00bb9c9ce4]

W/System.err( 2265): android.database.sqlite.SQLiteException: not an error (code 0)

 

TinyPortal © 2005-2018