iwongu / sqlite3pp

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

access to the sqlite3* pointer inside class database #31

Closed mutantdeveloper closed 8 years ago

mutantdeveloper commented 8 years ago

There are many sqlite3 features that are not supported by sqlite3pp::database. As a workaround, it would be nice if user can use the internal sqlite3* pointer.

Some useful features that are not supported;

  1. sqlite3_changes(): tell how many rows are changed.
  2. sqlite3_extended_errcode(): can be used to route errors based on more detailed classification.
iwongu commented 8 years ago

What if we add the useful methods in database class like enable_foreign_keys() or error_code() instead of exposing internal pointer?

iwongu commented 8 years ago

Added the methods. Let me know if you need more methods like these.

https://github.com/iwongu/sqlite3pp/commit/d755c07eba3cd623679ad30033aae343768b3bbe

mutantdeveloper commented 8 years ago

adding methods is always good. But there are many sqlite3 functions that I am afraid won't all be supported in sqlite3pp any time soon. Exposing internal pointer is not neat, but who uses it should be at his own risk.

iwongu commented 8 years ago

Do you have a list of functions in mind? I still prefer hiding the internal pointer in private.

mutantdeveloper commented 8 years ago

For now, I think changes() and extended_error_code() will be helpful

iwongu commented 8 years ago

As I wrote, they are already added in https://github.com/iwongu/sqlite3pp/commit/d755c07eba3cd623679ad30033aae343768b3bbe Git-pull to see them.