SRombauts / SQLiteCpp

SQLiteC++ (SQLiteCpp) is a smart and easy to use C++ SQLite3 wrapper.
http://srombauts.github.io/SQLiteCpp
MIT License
2.19k stars 509 forks source link

can we add bindBlob(int, const std::string &)? #466

Open etorth opened 4 months ago

etorth commented 4 months ago

Serialization of a simple type like int/char etc can be very short, use std::vector or something may overkill because of the memory allocation.

std::string is a good choice since it has SSO internal buffer.

But bind(int, const std::string &) always binds to TEXT, not blob. can we get a way explictly bind std::string to a BLOB type? Thanks! very easy to implement.

Or put a default parameter as: bind(int, const std::string &, bool bind_to_text = true); // false to BLOB

SRombauts commented 3 weeks ago

Yes, that's a good idea. I always welcome pull requests, especially if they are very simple, provide a unit test. Cheers!