iwongu / sqlite3pp

SQLite3++ - C++ wrapper of SQLite3 API
MIT License
609 stars 177 forks source link

return empty string on null entry #56

Closed rinigus closed 6 years ago

rinigus commented 6 years ago

This PR allows using std::string to retrieve null data values as well. If NULL, empty string is returned. I think, its more consistent interface and allows using the library in a simple manner. For those who want to distinguish empty string and NULL values, old approach through const char* should work.

Related: https://github.com/iwongu/sqlite3pp/issues/48

iwongu commented 6 years ago

The std::string version is intentionally not returning empty string when the value is NULL. The std::string version is for getting NOT NULL values. If the value is NULLABLE, const char* version should be used.

Sorry for the lack of explanations in the code and docs.