CYCLUS
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

◆ SqliteDb()

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

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

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

Definition at line 83 of file sqlite_db.cc.

◆ ~SqliteDb()

cyclus::SqliteDb::~SqliteDb ( )
virtual

Definition at line 91 of file sqlite_db.cc.

Member Function Documentation

◆ close()

void cyclus::SqliteDb::close ( )

Finishes any incomplete operations and closes the database.

Exceptions
IOErrorif failed to close the database properly

Definition at line 99 of file sqlite_db.cc.

◆ Execute()

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

Execute an SQL command.

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

Definition at line 139 of file sqlite_db.cc.

◆ open()

void cyclus::SqliteDb::open ( )

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

Exceptions
IOErrorif failed to open existing database

Definition at line 108 of file sqlite_db.cc.

◆ Overwrite()

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.

◆ Prepare()

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.

◆ Query()

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

Execute an SQL query and return its results.

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

Definition at line 160 of file sqlite_db.cc.


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