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

Can't work with BLOB #5

Open
stevensotelo opened this issue Dec 14, 2015 · 5 comments
Open

Can't work with BLOB #5

stevensotelo opened this issue Dec 14, 2015 · 5 comments

Comments

@stevensotelo
Copy link

Hello everyone

I watched that this plugin has one limitation with the blob field. I want to know what I can do to work with this type field. I am working with a Android. Thanks

@brodycj
Copy link
Owner

brodycj commented Dec 17, 2015

The BLOB feature is for future consideration. Ref: storesafe/cordova-sqlite-storage#263

Some alternatives:

  • Convert the binary data back and forth to Base64 string before storing. You may be interested in: nolanlawson / blob-util
  • Store your binary data in a flat file using the File API, and simply keep the file reference in the database

It is also theoretically possible to store your binary data as a string by simple character replacement transformations to deal with \u0000 (\0) bytes, as described in section 3 of http://pouchdb.com/2014/10/26/10-things-i-learned-from-reading-and-writing-the-pouchdb-source.html and done in pouchdb/pouchdb#2900 (you may want to see pouchdb/pouchdb#2900 (comment)). But both Android and iOS versions do have problems with certain UNICODE characters (TBD I will add references when I get a chance).

Ref(s) for additional reading:

This will be documented when I get a chance.

@trevorpowell
Copy link

I'm wondering, is this something that changed when cordova-sqlite-ext was cut from cordova-sqlite-storage? I have an example that used to work in cordova-sqlite-storage where it would select a blob value with a query and then convert the data for display. Now it seems when it tries the select query, the value for the blob column is not returned but those for integer columns in the same row are. The only thing that's changed in my example is replacing cordova-sqlite-storage with cordova-sqlite-ext.

@trevorpowell
Copy link

Looks like reading blob columns was removed in version 0.7.11 due to this issue:
https://issues.apache.org/jira/browse/CB-9638

@stevensotelo
Copy link
Author

Hi @trevorpowell

I have a problem with cordova-sqlite-storage, because it doesn't work very good with pre-populated database,

@trevorpowell
Copy link

I use a pre-populated database in my use case too, and using version 0.7.10 of cordova-sqlite-storage is working okay for me right now. That version was before the support for pre-populated databases was moved to cordova-sqlite-ext. That seems like the only solution for me right now, at least until the ability to read blob type fields is added back into cordova-sqlite-ext.

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

No branches or pull requests

3 participants