CYCLUS
Loading...
Searching...
No Matches
cyclus::SqliteBack Class Reference

Detailed Description

An Recorder backend that writes data to an sqlite database.

Identically named Datum objects have their data placed as rows in a single table. Handles the following datum value types: int, float, double, std::string, cyclus::Blob. Unsupported value types are stored as an empty string.

Definition at line 17 of file sqlite_back.h.

#include <sqlite_back.h>

Inheritance diagram for cyclus::SqliteBack:
cyclus::FullBackend cyclus::QueryableBackend cyclus::RecBackend

Public Member Functions

void Close ()
 
virtual std::map< std::string, DbTypesColumnTypes (std::string table)
 
SqliteDbdb ()
 
void Flush ()
 
std::string Name ()
 
virtual void Notify (DatumList data)
 
virtual QueryResult Query (std::string table, std::vector< Cond > *conds)
 
 SqliteBack (std::string path)
 
virtual std::set< std::string > Tables ()
 
virtual ~SqliteBack ()
 
- Public Member Functions inherited from cyclus::FullBackend
virtual ~FullBackend ()
 
- Public Member Functions inherited from cyclus::QueryableBackend
virtual ~QueryableBackend ()
 
- Public Member Functions inherited from cyclus::RecBackend
virtual ~RecBackend ()
 

Constructor & Destructor Documentation

◆ SqliteBack()

cyclus::SqliteBack::SqliteBack ( std::string path)

Creates a new sqlite backend that will write to the database file specified by path.

If the file doesn't exist, a new one is created.

Parameters
paththe filepath (including name) to write the sqlite file.

Definition at line 47 of file sqlite_back.cc.

◆ ~SqliteBack()

cyclus::SqliteBack::~SqliteBack ( )
virtual

Definition at line 38 of file sqlite_back.cc.

Member Function Documentation

◆ Close()

void cyclus::SqliteBack::Close ( )
inlinevirtual

Closes the backend, if approriate.

Implements cyclus::RecBackend.

Definition at line 37 of file sqlite_back.h.

◆ ColumnTypes()

std::map< std::string, DbTypes > cyclus::SqliteBack::ColumnTypes ( std::string table)
virtual

Return a map of column names of the specified table to the associated database type.

Implements cyclus::QueryableBackend.

Definition at line 139 of file sqlite_back.cc.

◆ db()

SqliteDb & cyclus::SqliteBack::db ( )

Returns the underlying sqlite database.

Only use this if you really know what you are doing.

Definition at line 161 of file sqlite_back.cc.

◆ Flush()

void cyclus::SqliteBack::Flush ( )
virtual

Executes all pending commands.

Implements cyclus::RecBackend.

Definition at line 91 of file sqlite_back.cc.

◆ Name()

std::string cyclus::SqliteBack::Name ( )
virtual

Returns a unique name for this backend.

Implements cyclus::RecBackend.

Definition at line 183 of file sqlite_back.cc.

◆ Notify()

void cyclus::SqliteBack::Notify ( DatumList data)
virtual

Writes Datum objects immediately to the database as a single transaction.

Parameters
datagroup of Datum objects to write to the database together.

Implements cyclus::RecBackend.

Definition at line 70 of file sqlite_back.cc.

◆ Query()

QueryResult cyclus::SqliteBack::Query ( std::string table,
std::vector< Cond > * conds )
virtual

Return a set of rows from the specificed table that match all given conditions.

Conditions are AND'd together. conds may be NULL.

Implements cyclus::QueryableBackend.

Definition at line 103 of file sqlite_back.cc.

◆ Tables()

std::set< std::string > cyclus::SqliteBack::Tables ( )
virtual

Return a set of all table names currently in the database.

Implements cyclus::QueryableBackend.

Definition at line 147 of file sqlite_back.cc.


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