3 #include "database.hxx"
38 int ret = sqlite3_prepare_v2 (db_.raw(), sql, -1, &stmt, NULL);
39 stmt_.reset (
new Statement_ (stmt));
41 if (ret != SQLITE_OK) {
56 return bind_ (sqlite3_bind_text (raw(), bindI_, s.c_str(), s.size(), NULL));
69 return bind_ (sqlite3_bind_int (raw(), bindI_, i));
81 i = sqlite3_column_int (raw(), colI_);
96 s =
reinterpret_cast<char const *
> (sqlite3_column_text (raw(), colI_));
117 int ret = sqlite3_step (raw());
118 if (ret == SQLITE_ERROR) {
127 if (ret != SQLITE_OK) {
135 sqlite3_stmt * raw () {
return stmt_->stmt_; }
139 Statement_ (sqlite3_stmt *stmt) : stmt_(stmt) {}
140 ~Statement_ () { sqlite3_finalize (stmt_); }
146 std::shared_ptr<Statement_> stmt_;