|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
19 #ifndef SQLITE_OUTPUT_H
20 #define SQLITE_OUTPUT_H
22 #include "ns3/simple-ref-count.h"
25 #include <semaphore.h>
53 SQLiteOutput (
const std::string &name,
const std::string &semName);
80 bool SpinExec (sqlite3_stmt *stmt)
const;
93 bool WaitExec (sqlite3_stmt *stmt)
const;
101 bool WaitPrepare (sqlite3_stmt **stmt,
const std::string &
cmd)
const;
109 bool SpinPrepare (sqlite3_stmt **stmt,
const std::string &
cmd)
const;
118 bool Bind (sqlite3_stmt *stmt,
int pos,
const T &value)
const;
136 static int SpinStep (sqlite3_stmt *stmt);
154 static int SpinReset (sqlite3_stmt *stmt);
163 int WaitExec (sqlite3 *db,
const std::string &
cmd)
const;
170 int WaitExec (sqlite3 *db, sqlite3_stmt *stmt)
const;
178 int WaitPrepare (sqlite3 *db, sqlite3_stmt **stmt,
const std::string &
cmd)
const;
186 static int SpinExec (sqlite3 *db,
const std::string &
cmd);
188 static int SpinExec (sqlite3 *db, sqlite3_stmt *stmt);
196 static int SpinPrepare (sqlite3 *db, sqlite3_stmt **stmt,
const std::string &
cmd);
203 [[ noreturn ]]
static void Error (sqlite3 *db,
const std::string &
cmd);
213 static bool CheckError (sqlite3 *db,
int rc,
const std::string &
cmd,
214 sem_t *sem,
bool hardExit);
bool Bind(sqlite3_stmt *stmt, int pos, const T &value) const
Bind a value to a sqlite statement.
~SQLiteOutput()
Destructor.
T RetrieveColumn(sqlite3_stmt *stmt, int pos) const
Retrieve a value from an executed statement.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool SpinPrepare(sqlite3_stmt **stmt, const std::string &cmd) const
Prepare a statement.
bool WaitExec(const std::string &cmd) const
Execute a command, waiting on a system semaphore.
A template-based reference counting class.
std::string m_dBname
Database name.
static int SpinReset(sqlite3_stmt *stmt)
Reset a statement until the result is ok or an error.
sqlite3 * m_db
Database pointer.
static void Error(sqlite3 *db, const std::string &cmd)
Fail, printing an error message from sqlite.
static int SpinStep(sqlite3_stmt *stmt)
Execute a step operation on a statement until the result is ok or an error.
static bool CheckError(sqlite3 *db, int rc, const std::string &cmd, sem_t *sem, bool hardExit)
Check any error in the db.
std::string m_semName
System semaphore name.
bool SpinExec(const std::string &cmd) const
Execute a command until the return value is OK or an ERROR.
void SetJournalInMemory()
Instruct SQLite to store the journal in memory.
SQLiteOutput(const std::string &name, const std::string &semName)
SQLiteOutput constructor.
static int SpinFinalize(sqlite3_stmt *stmt)
Finalize a statement until the result is ok or an error.
A C++ interface towards an SQLITE database.
bool WaitPrepare(sqlite3_stmt **stmt, const std::string &cmd) const
Prepare a statement, waiting on a system semaphore.