iwongu / sqlite3pp

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

sqlite3_prepare or sqlite3_prepare_v2 #49

Closed csroli closed 7 years ago

csroli commented 7 years ago

Hello!

Do you have a specific reason for using sqlite3_prepare instead of sqlite3_prepare_v2?

The v2 form has an advantage, that it can recompile the statement on schema change, instead of returning SQLITE_SCHEMA error code. I had a problem related to this, and changing sqlite3_prepare to sqlite3_prepare_v2 resolved that.

Also, the documentation states:

The preferred routine to use is sqlite3_prepare_v2(). The sqlite3_prepare() interface is legacy and should be avoided.

The sqlite3_prepare_v2(), ... interfaces are recommended for all new programs. The older interfaces (...) are retained for backwards compatibility, but their use is discouraged.

iwongu commented 7 years ago

No reasons using the legacy one. Maybe there was no v2 when it's written first time? Anyway, I'll work on it. Thanks for reporting!

iwongu commented 7 years ago

Check this commit out. https://github.com/iwongu/sqlite3pp/commit/4d1386971e5570b0a072d34844c470b31251ff9b The change is published in v1.0.8