NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::util::Sqlite3Statement Class Reference

wrap an SQLite3 prepared statement More...

#include <sqlite3-statement.hpp>

Inheritance diagram for ndn::util::Sqlite3Statement:
Collaboration diagram for ndn::util::Sqlite3Statement:

Public Member Functions

 Sqlite3Statement (sqlite3 *database, const std::string &statement)
 initialize and prepare Sqlite3 statement More...
 
 ~Sqlite3Statement ()
 finalize the statement More...
 
int bind (int index, const char *value, size_t size, void(*destructor)(void *))
 bind a string to the statement More...
 
int bind (int index, const std::string &value, void(*destructor)(void *))
 bind a string to the statement More...
 
int bind (int index, const void *value, size_t size, void(*destructor)(void *))
 bind a byte blob to the statement More...
 
int bind (int index, const Block &block, void(*destructor)(void *))
 bind a byte blob to the statement More...
 
int bind (int index, int number)
 bind an integer to the statement More...
 
std::string getString (int column)
 get a string from column. More...
 
Block getBlock (int column)
 get a block from column. More...
 
int getInt (int column)
 get an integer from column. More...
 
const uint8_t * getBlob (int column)
 get a pointer of byte blob from column. More...
 
int getSize (int column)
 get the size of column. More...
 
int step ()
 wrapper of sqlite3_step More...
 
 operator sqlite3_stmt * ()
 implicitly converts to sqlite3_stmt* to be used in SQLite C API More...
 

Detailed Description

wrap an SQLite3 prepared statement

Warning
This class is implementation detail of ndn-cxx library.

Definition at line 38 of file sqlite3-statement.hpp.

Constructor & Destructor Documentation

ndn::util::Sqlite3Statement::Sqlite3Statement ( sqlite3 *  database,
const std::string &  statement 
)

initialize and prepare Sqlite3 statement

Parameters
databasehandler to open sqlite3 database
statementSQL statement
Exceptions
std::domain_errorSQL statement is bad

Definition at line 34 of file sqlite3-statement.cpp.

ndn::util::Sqlite3Statement::~Sqlite3Statement ( )

finalize the statement

Definition at line 29 of file sqlite3-statement.cpp.

Member Function Documentation

int ndn::util::Sqlite3Statement::bind ( int  index,
const char *  value,
size_t  size,
void(*)(void *)  destructor 
)

bind a string to the statement

Parameters
indexThe binding position
valueThe pointer of the binding string
valueThe size of the binding string
destructorSQLite3 destructor, e.g., SQLITE_TRANSIENT
Returns
SQLite result value.

Definition at line 42 of file sqlite3-statement.cpp.

int ndn::util::Sqlite3Statement::bind ( int  index,
const std::string &  value,
void(*)(void *)  destructor 
)

bind a string to the statement

Parameters
indexThe binding position
valueThe binding string
destructorSQLite3 destructor, e.g., SQLITE_TRANSIENT
Returns
SQLite result value.

Definition at line 48 of file sqlite3-statement.cpp.

int ndn::util::Sqlite3Statement::bind ( int  index,
const void *  value,
size_t  size,
void(*)(void *)  destructor 
)

bind a byte blob to the statement

Parameters
indexThe binding position
valueThe pointer of the blob
valueThe size of the blob
destructorSQLite3 destructor, e.g., SQLITE_TRANSIENT
Returns
SQLite result value.

Definition at line 54 of file sqlite3-statement.cpp.

int ndn::util::Sqlite3Statement::bind ( int  index,
const Block block,
void(*)(void *)  destructor 
)

bind a byte blob to the statement

Parameters
indexThe binding position
blockThe binding block
destructorSQLite3 destructor, e.g., SQLITE_TRANSIENT
Returns
SQLite result value

Definition at line 60 of file sqlite3-statement.cpp.

References ndn::Block::size(), and ndn::Block::wire().

int ndn::util::Sqlite3Statement::bind ( int  index,
int  number 
)

bind an integer to the statement

Parameters
indexThe binding position
numberThe binding integer
Returns
SQLite result value

Definition at line 66 of file sqlite3-statement.cpp.

std::string ndn::util::Sqlite3Statement::getString ( int  column)

get a string from column.

Definition at line 72 of file sqlite3-statement.cpp.

Block ndn::util::Sqlite3Statement::getBlock ( int  column)

get a block from column.

Definition at line 79 of file sqlite3-statement.cpp.

int ndn::util::Sqlite3Statement::getInt ( int  column)

get an integer from column.

Definition at line 85 of file sqlite3-statement.cpp.

const uint8_t * ndn::util::Sqlite3Statement::getBlob ( int  column)

get a pointer of byte blob from column.

Definition at line 92 of file sqlite3-statement.cpp.

int ndn::util::Sqlite3Statement::getSize ( int  column)

get the size of column.

Definition at line 98 of file sqlite3-statement.cpp.

int ndn::util::Sqlite3Statement::step ( )

wrapper of sqlite3_step

Definition at line 104 of file sqlite3-statement.cpp.

ndn::util::Sqlite3Statement::operator sqlite3_stmt * ( )

implicitly converts to sqlite3_stmt* to be used in SQLite C API

Definition at line 109 of file sqlite3-statement.cpp.


The documentation for this class was generated from the following files: