10#include "ns3/simple-ref-count.h"
63 bool SpinExec(
const std::string& cmd)
const;
70 bool SpinExec(sqlite3_stmt* stmt)
const;
77 bool WaitExec(
const std::string& cmd)
const;
84 bool WaitExec(sqlite3_stmt* stmt)
const;
92 bool WaitPrepare(sqlite3_stmt** stmt,
const std::string& cmd)
const;
100 bool SpinPrepare(sqlite3_stmt** stmt,
const std::string& cmd)
const;
109 template <
typename T>
110 bool Bind(sqlite3_stmt* stmt,
int pos,
const T& value)
const;
118 template <
typename T>
130 static int SpinStep(sqlite3_stmt* stmt);
148 static int SpinReset(sqlite3_stmt* stmt);
157 int WaitExec(sqlite3* db,
const std::string& cmd)
const;
165 int WaitExec(sqlite3* db, sqlite3_stmt* stmt)
const;
174 int WaitPrepare(sqlite3* db, sqlite3_stmt** stmt,
const std::string& cmd)
const;
182 static int SpinExec(sqlite3* db,
const std::string& cmd);
190 static int SpinExec(sqlite3* db, sqlite3_stmt* stmt);
199 static int SpinPrepare(sqlite3* db, sqlite3_stmt** stmt,
const std::string& cmd);
206 [[noreturn]]
static void Error(sqlite3* db,
const std::string& cmd);
216 static bool CheckError(sqlite3* db,
int rc,
const std::string& cmd,
bool hardExit);
A C++ interface towards an SQLITE database.
sqlite3 * m_db
Database pointer.
std::string m_dBname
Database name.
bool SpinExec(const std::string &cmd) const
Execute a command until the return value is OK or an ERROR.
static bool CheckError(sqlite3 *db, int rc, const std::string &cmd, bool hardExit)
Check any error in the db.
~SQLiteOutput()
Destructor.
static int SpinStep(sqlite3_stmt *stmt)
Execute a step operation on a statement until the result is ok or an error.
void SetJournalInMemory()
Instruct SQLite to store the journal in memory.
T RetrieveColumn(sqlite3_stmt *stmt, int pos) const
Retrieve a value from an executed statement.
bool Bind(sqlite3_stmt *stmt, int pos, const T &value) const
Bind a value to a sqlite statement.
static int SpinReset(sqlite3_stmt *stmt)
Reset a statement until the result is ok or an error.
static int SpinFinalize(sqlite3_stmt *stmt)
Finalize a statement until the result is ok or an error.
bool WaitExec(const std::string &cmd) const
Execute a command, waiting on a mutex.
static void Error(sqlite3 *db, const std::string &cmd)
Fail, printing an error message from sqlite.
bool SpinPrepare(sqlite3_stmt **stmt, const std::string &cmd) const
Prepare a statement.
SQLiteOutput(const std::string &name)
SQLiteOutput constructor.
bool WaitPrepare(sqlite3_stmt **stmt, const std::string &cmd) const
Prepare a statement, waiting on a mutex.
A template-based reference counting class.
Every class exported by the ns3 library is enclosed in the ns3 namespace.