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

Error selecting Blob column #233

Closed
henintsoa-raharinatoandro opened this issue May 26, 2024 · 2 comments
Closed

Error selecting Blob column #233

henintsoa-raharinatoandro opened this issue May 26, 2024 · 2 comments

Comments

@henintsoa-raharinatoandro
Copy link

henintsoa-raharinatoandro commented May 26, 2024

I am getting an error using db.select
It seem like it tries to open the blob column as a Text

sqlcipher_flutter_libs: ^0.6.2
Ubuntu 22.04

ex: "SELECT blobColumn FROM data ;"

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: FormatException: Invalid UTF-8 byte (at offset 0)
#0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1741:7)
#1      Utf8Decoder.convert (dart:convert/utf.dart:349:37)
#2      Utf8Codec.decode (dart:convert/utf.dart:63:20)
#3      Utf8Utils.readString (package:sqlite3/src/ffi/memory.dart:59:17)
#4      FfiStatement.sqlite3_column_text (package:sqlite3/src/ffi/bindings.dart:460:54)
#5      StatementImplementation._readValue (package:sqlite3/src/implementation/statement.dart:175:26)
#6      StatementImplementation._selectResults (package:sqlite3/src/implementation/statement.dart:139:64)
#7      StatementImplementation.selectWith (package:sqlite3/src/implementation/statement.dart:296:12)
#8      CommonPreparedStatement.select (package:sqlite3/src/statement.dart:71:12)
#9      DatabaseImplementation.select (package:sqlite3/src/implementation/database.dart:389:19)
@simolus3
Copy link
Owner

Can you post a full sample I could run (e.g. something that creates the table, inserts the blob and then tries to select which fails)? We have tests for this package and they are reading from blobs just fine, so I assume there's something weird going on with the database where a blob column is reported as text by sqlite3. I need more information to reproduce this problem.

@henintsoa-raharinatoandro
Copy link
Author

Thank you for your quick reply.

You’re right! It seems my database might be corrupt or malfunctioning. I removed some records in preparation for posting it here, but I was unable to reproduce the issue with that modified database.

Thank you for pointing me in the right direction.

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

2 participants