18 struct Error :
public std::runtime_error {
23 Error (
const std::string & what)
24 : std::runtime_error (what)
41 int ret = sqlite3_open (fileName.c_str(), &db);
42 db_.reset (
new Sqlite3_ (db));
44 if (ret != SQLITE_OK) {
56 int execute (
char const *
const sql);
74 return sqlite3_errmsg(raw());
82 return sqlite3_last_insert_rowid (raw());
86 sqlite3 * raw () {
return db_->db_; }
90 Sqlite3_ (sqlite3 *db) : db_ (db) {}
91 ~Sqlite3_ () { sqlite3_close (db_); }
93 std::shared_ptr<Sqlite3_> db_;
95 friend class Statement;