WebReflection / dblite

sqlite for node.js without gyp problems
MIT License
209 stars 34 forks source link

Problem with JSON.stringify on binary BLOB fields #19

Closed erf closed 10 years ago

erf commented 10 years ago

When dblite uses JSON.stringify on binary BLOB fields, there is a problem when i want to use sqlite3 dbs created by others with binary data (not stringified). I now need to have two different ways of parsing them. I wish BLOB fields where not stringified, or one could make it optional.

WebReflection commented 10 years ago

how would you deal with such data by sqlite3 shell ?

erf commented 10 years ago

this worked for me.

http://stackoverflow.com/questions/10353467/how-to-insert-binary-data-into-sqlite3-database-in-bash

2013/11/14 Andrea Giammarchi notifications@github.com

how would you deal with such data by sqlite3 shell ?

— Reply to this email directly or view it on GitHubhttps://github.com/WebReflection/dblite/issues/19#issuecomment-28506050 .

WebReflection commented 10 years ago

so that uses external parsing software and pipes, not really what I would implement in here, plus that is a hack.

dblite has no notion of fields types, but if you know one field is a blob, you should be able to pass a meaningful string representation of that data upfront, right?

JSON.stringify is used to simplify most common cases and I am not sure this is both common and worth to be solved. As you don't want to have problems with other implementations, you want also be able to have fields back as Blobs through JSON.parse, am I correct ?

I will keep this open thinking about a possible solution when the object is a blob, and there is a better/simple way to pass it through the spawned stdin.

NanduriSaiJyothiMalathi commented 5 years ago

Hi , I have huge number of json data to stringfy and send to server . As my UI not responding while executing that line so i decided to send the data as file to server instead of stringfying it .

Is blob in javascript can be useful?

Please let me know how can i do this . Thanks in advance.