Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue getting blob data with cordova-plugin-sqlite #1020

Open
skelvin opened this issue Feb 6, 2024 · 0 comments
Open

Issue getting blob data with cordova-plugin-sqlite #1020

skelvin opened this issue Feb 6, 2024 · 0 comments

Comments

@skelvin
Copy link

skelvin commented Feb 6, 2024

i have an sqlite table with three columns; key with datatype int, provider with datatype text and tile with datatype blob.
Whenever i use a select query to get data from the table ie "SELECT tile FROM tiles", my application crashes and the blob column is the issue. this is the a snippet of the error i get from logcat.

[AUX]GuiExtAuxCheckAuxPath:674: Null anb
2024-02-06 19:44:49.145 25403-14655 com.adit com.adit A java_vm_ext.cc:591] JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal start byte 0x89
java_vm_ext.cc:591] string: '?PNG
java_vm_ext.cc:591] �
java_vm_ext.cc:591] '
java_vm_ext.cc:591] input: '<0x89> 0x50 0x4e 0x47 0x0d 0x0a 0x1a 0x0a'
java_vm_ext.cc:591] in call to NewStringUTF
java_vm_ext.cc:591] from java.lang.String io.liteglue.SQLiteNDKNativeDriver.sqlc_st_column_text_native(long, int)
2024-02-06 19:44:49.547 25403-25403 chromium com.adit I [INFO:CONSOLE(49)] "Table names in the database:", source: http://localhost:8101/test-page-test-page-module.js (49)
2024-02-06 19:44:49.547 25403-25403 chromium com.adit I [INFO:CONSOLE(51)] "tiles", source: http://localhost:8101/test-page-test-page-module.js (51)
2024-02-06 19:44:49.571 25403-25403 Choreographer com.adit I Skipped 39 frames! The application may be doing too much work on its main thread.
2024-02-06 19:44:49.572 25403-25403 Quality com.adit I Skipped: true 39 cost 436.1615 refreshRate 11111111 bit true processName com.adit
2024-02-06 19:44:49.595 25403-14655 om.adit com.dit A runtime.cc:691] Runtime aborting...

im developing using ionic, cordova with angular and my target platform is android
ionic-native/sqlite version 5.36.0
cordova-plugin-sqlite version 6.0.0
ionic version 7.1.1
cordova version 12.0.0

below is a snippet of the code that selects the data from the table

private async getAllRecords(): Promise<TilesInterface[]> {
  let details: TilesInterface[] = [];
  try {
    let details: TilesInterface[] = [];
    const res = await this.dbInstance.executeSql('SELECT key, provider, tile FROM tiles', []);

    for (let x = 0; x < res.rows.length; x++) {
      const row = res.rows.item(x);
      const tileData: ArrayBuffer = row.tile; // Access as ArrayBuffer
      details.push({ key: row.key, provider: row.provider, tile: tileData });
    }

    return details;

  } catch (e) {
    console.error('Error opening transaction:', e);
  }

return details;

}

iv tried using DB Browser for sqlite to check incase the database is corrupt but it works properly.
I should also probably mention that the sqlite db file is provided by service and not created and populated in the app itself. i use cordova-plugin-files to download it from my server and store it in the database directory of my android app.

this is an example of the sqlite file im working with
city.zip

please help me, thank you in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant