31 sqlite3_finalize(m_stmt);
36 int res = sqlite3_prepare_v2(database, statement.data(), -1, &m_stmt,
nullptr);
38 BOOST_THROW_EXCEPTION(std::domain_error(
"bad SQL statement: " + statement));
44 return sqlite3_bind_text(m_stmt, index, value, size, destructor);
50 return sqlite3_bind_text(m_stmt, index, value.c_str(), value.size(), destructor);
56 return sqlite3_bind_blob(m_stmt, index, buf, size, destructor);
62 return sqlite3_bind_blob(m_stmt, index, block.
wire(), block.
size(), destructor);
68 return sqlite3_bind_int(m_stmt, index, number);
74 return std::string(reinterpret_cast<const char*>(sqlite3_column_text(m_stmt, column)),
75 sqlite3_column_bytes(m_stmt, column));
81 return Block(reinterpret_cast<const uint8_t*>(sqlite3_column_blob(m_stmt, column)),
82 sqlite3_column_bytes(m_stmt, column));
88 return sqlite3_column_int(m_stmt, column);
95 return static_cast<const uint8_t*>(sqlite3_column_blob(m_stmt, column));
101 return sqlite3_column_bytes(m_stmt, column);
107 return sqlite3_step(m_stmt);
110 Sqlite3Statement::operator sqlite3_stmt*()
Copyright (c) 2011-2015 Regents of the University of California.
int getSize(int column)
get the size of column.
const uint8_t * wire() const
Get pointer to encoded wire.
~Sqlite3Statement()
finalize the statement
Represents a TLV element of NDN packet format.
Sqlite3Statement(sqlite3 *database, const std::string &statement)
initialize and prepare Sqlite3 statement
Block getBlock(int column)
get a block from column.
size_t size() const
Get size of encoded wire, including Type-Length-Value.
const uint8_t * getBlob(int column)
get a pointer of byte blob from column.
int bind(int index, const char *value, size_t size, void(*destructor)(void *))
bind a string to the statement
std::string getString(int column)
get a string from column.
int step()
wrapper of sqlite3_step
int getInt(int column)
get an integer from column.