CYCLUS
|
An abstraction over the Sqlite native C interface to simplify database creation and data insertion.
Definition at line 77 of file sqlite_db.h.
#include <sqlite_db.h>
Public Member Functions | |
void | close () |
void | Execute (std::string cmd) |
void | open () |
void | Overwrite () |
SqlStatement::Ptr | Prepare (std::string sql) |
std::vector< StrList > | Query (std::string cmd) |
SqliteDb (std::string path, bool readonly=false) | |
virtual | ~SqliteDb () |
Creates a new Sqlite database to be stored at the specified path.
path | the path+name for the sqlite database file |
readonly | a boolean indicating true if db is readonly |
Definition at line 83 of file sqlite_db.cc.
|
virtual |
Definition at line 91 of file sqlite_db.cc.
void cyclus::SqliteDb::close | ( | ) |
Finishes any incomplete operations and closes the database.
IOError | if failed to close the database properly |
Definition at line 99 of file sqlite_db.cc.
void cyclus::SqliteDb::Execute | ( | std::string | cmd | ) |
Execute an SQL command.
cmd | an Sqlite compatible SQL command |
IOError | SQL command execution failed (e.g. invalid SQL) |
Definition at line 139 of file sqlite_db.cc.
void cyclus::SqliteDb::open | ( | ) |
Opens the sqlite database by either opening/creating a file (default) or creating/overwriting a file (see the overwrite method).
IOError | if failed to open existing database |
Definition at line 108 of file sqlite_db.cc.
void cyclus::SqliteDb::Overwrite | ( | ) |
Instead of opening a file of the specified name (if it already exists), overwrite it with a new empty database.
Definition at line 94 of file sqlite_db.cc.
SqlStatement::Ptr cyclus::SqliteDb::Prepare | ( | std::string | sql | ) |
Creates a sqlite prepared statement for the given sql.
See http://sqlite.org/cintro.html for an overview of how prepared statements work.
Definition at line 133 of file sqlite_db.cc.
std::vector< StrList > cyclus::SqliteDb::Query | ( | std::string | cmd | ) |
Execute an SQL query and return its results.
cmd | an Sqlite compatible SQL query |
IOError | SQL command execution failed (e.g. invalid SQL) |
Definition at line 160 of file sqlite_db.cc.