Public Member Functions | List of all members
cyclus::SqliteDb Class Reference

Detailed Description

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< StrListQuery (std::string cmd)
 SqliteDb (std::string path, bool readonly=false)
virtual ~SqliteDb ()

Constructor & Destructor Documentation

cyclus::SqliteDb::SqliteDb ( std::string  path,
bool  readonly = false 

Creates a new Sqlite database to be stored at the specified path.

paththe path+name for the sqlite database file
readonlya boolean indicating true if db is readonly

Definition at line 83 of file

cyclus::SqliteDb::~SqliteDb ( )

Definition at line 91 of file

Member Function Documentation

void cyclus::SqliteDb::close ( )

Finishes any incomplete operations and closes the database.

IOErrorif failed to close the database properly

Definition at line 99 of file

void cyclus::SqliteDb::Execute ( std::string  cmd)

Execute an SQL command.

cmdan Sqlite compatible SQL command
IOErrorSQL command execution failed (e.g. invalid SQL)

Definition at line 139 of file

void cyclus::SqliteDb::open ( )

Opens the sqlite database by either opening/creating a file (default) or creating/overwriting a file (see the overwrite method).

IOErrorif failed to open existing database

Definition at line 108 of file

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

SqlStatement::Ptr cyclus::SqliteDb::Prepare ( std::string  sql)

Creates a sqlite prepared statement for the given sql.

See for an overview of how prepared statements work.

Definition at line 133 of file

std::vector< StrList > cyclus::SqliteDb::Query ( std::string  cmd)

Execute an SQL query and return its results.

cmdan Sqlite compatible SQL query
a list of row entries
IOErrorSQL command execution failed (e.g. invalid SQL)

Definition at line 160 of file

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