19 #ifndef OST_IO_SQLITE_WRAP_HH
20 #define OST_IO_SQLITE_WRAP_HH
27 #include <boost/shared_ptr.hpp>
35 namespace ost {
namespace db {
50 sqlite3_stmt* Handle()
57 return sqlite3_step(statement_)==SQLITE_DONE;
60 void BindInt(
int col,
int value)
62 sqlite3_bind_int(statement_, col, value);
65 void BindInt64(
int col, sqlite3_int64 value)
67 sqlite3_bind_int64(statement_, col, value);
70 void BindText(
int col,
const String& text)
72 sqlite3_bind_text(statement_, col, text.c_str(),
73 static_cast<int>(text.size()), NULL);
76 void BindBlob(
int col,
const char* start,
size_t size)
78 sqlite3_bind_blob(statement_, col, start, size, NULL);
81 sqlite3_stmt* statement_;
110 template <
typename R>
114 stmt_(stmt), value_()
119 stmt_(), value_(), cur_val_(SQLITE_DONE)
132 return cur_val_!=SQLITE_ROW;
137 cur_val_=sqlite3_step(stmt_->Handle());
138 if (cur_val_==SQLITE_ROW) {
168 sqlite3_int64 LastRowID();