Mcalc  0.1
a machinist's calculator
Public Member Functions | Static Public Member Functions | List of all members
mc::DataStore Class Reference

#include <datastore.hpp>

Public Member Functions

 ~DataStore ()
 
std::vector< std::vector< std::string > > get (std::vector< Interface * > r, std::vector< std::string > cols)
 
std::vector< std::vector< std::string > > get (std::vector< Interface * > r)
 
void update (std::string table, std::map< std::string, std::string > s, std::map< std::string, std::string > v)
 
std::vector< std::map< std::string, std::string > > fetch (std::string table, std::map< std::string, std::string > s)
 
std::vector< std::map< std::string, std::string > > fetch (std::string table, std::map< std::string, std::string > s, std::vector< std::string > v)
 

Static Public Member Functions

static DataStoreget_instance ()
 

Detailed Description

This is the main source of all data used by the application. It contains tables of values that are used to populate the UI and perform calculations.

Constructor & Destructor Documentation

mc::DataStore::~DataStore ( )

The destructor

Member Function Documentation

std::vector< std::map< std::string, std::string > > mc::DataStore::fetch ( std::string  table,
std::map< std::string, std::string >  s 
)

Fetch a record from the database.

Parameters
tableThe table to search in.
sThe key/value pairs to match against.
Returns
A vector of vectors of strings (rows from the database).
std::vector< std::map< std::string, std::string > > mc::DataStore::fetch ( std::string  table,
std::map< std::string, std::string >  s,
std::vector< std::string >  v 
)

Fetch a record from the database.

Parameters
tableThe table to search in.
sThe key/value pairs to match against.
vThe values to fetch.
Returns
A vector of vectors of strings (rows from the database).
std::vector< std::vector< std::string > > mc::DataStore::get ( std::vector< Interface * >  r,
std::vector< std::string >  cols 
)

Get records from the database using a collection of Interface objects to build a query.

Parameters
rThe Interfaces to use as a reference.
colsThe columns to return
std::vector< std::vector< std::string > > mc::DataStore::get ( std::vector< Interface * >  r)

Get records from the database using a collection of Interface objects to build a query. All columns are returned.

Parameters
rThe Interfaces to use as a reference.
DataStore * mc::DataStore::get_instance ( )
static

Get the existing datastore instance or create a new datastore and return it.

void mc::DataStore::update ( std::string  table,
std::map< std::string, std::string >  s,
std::map< std::string, std::string >  v 
)

Update a record matching given key/values with new key/values.

Parameters
tableThe table name to search in.
sThe keys/values to match against.
vThe keys/values to update.

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