WebReflection / dblite

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

Added supporting for buffers #31

Closed borispovod closed 7 years ago

borispovod commented 9 years ago

I tried to insert Buffer value, but it's not worked. Fixed now.

WebReflection commented 9 years ago

I don't mind leaving the .idea in the ignore list but I am not planning to put all the .idea related things in. Also there is no test that validates against buffers so it won't land until it's tested.

Thanks for the hint though!

WebReflection commented 9 years ago

also please consider returning a buffer and add Buffer as expected type. I think it might be less problematic simply cast the buffer upfront as string though.

borispovod commented 9 years ago

You can't return buffer as string from command line, only like hex and then convert to buffer

WebReflection commented 9 years ago

I know ... so it doesn't return booleans or numbers but dblite does. If you can magically store a type that is not JSON compatible I'd expect you to be able to retrieve it too. Meaning custom types might not be that easy to implement 'cause I'd expect a one to one i/o

So we need tests and a way to retrieve the string as Buffer. Can we have such logic in? Good. If we can't, I'm afraid users must be in charge of converting to hex/base64 and re-convert once retrieved by their own with all utilities already available to parse returned data.

borispovod commented 9 years ago

Updated with tests, and looks like i some requests get valid buffer from select, will see later And added missed dev dependencies in package.json

borispovod commented 9 years ago

So, looks like it not possible - to get binary as string. All documentation said me to get it as hex string. I made auto convert from hex to buffer, if you provide Buffer as field type. Will use in my project for now.

borispovod commented 9 years ago

Look at last fix pls On my Windows 7 EOL was invalid, not \r\n, just \n Sqlite version 3.8.8.1

WebReflection commented 9 years ago

watch out that newlines have been normalized with SQL 3.8.6 and above .... dows this work with newer and older SQLite versions?