NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: 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

◆ Sqlite3Statement()

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.

◆ ~Sqlite3Statement()

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

finalize the statement

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

Member Function Documentation

◆ bind() [1/5]

◆ bind() [2/5]

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.

◆ bind() [3/5]

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
sizeThe size of the blob
destructorSQLite3 destructor, e.g., SQLITE_TRANSIENT
Returns
SQLite result value.

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

◆ bind() [4/5]

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().

◆ bind() [5/5]

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.

◆ getString()

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

get a string from column.

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

Referenced by ndn::security::pib::PibSqlite3::getTpmLocator().

◆ getBlock()

◆ getInt()

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

get an integer from column.

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

◆ getBlob()

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

get a pointer of byte blob from column.

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

Referenced by ndn::security::pib::PibSqlite3::getKeyBits().

◆ getSize()

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

get the size of column.

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

Referenced by ndn::security::pib::PibSqlite3::getKeyBits().

◆ step()

◆ operator sqlite3_stmt *()

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

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

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


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