Mcalc
0.1
a machinist's calculator
|
#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 DataStore * | get_instance () |
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.
mc::DataStore::~DataStore | ( | ) |
The destructor
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.
table | The table to search in. |
s | The key/value pairs to match against. |
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.
table | The table to search in. |
s | The key/value pairs to match against. |
v | The values to fetch. |
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.
r | The Interfaces to use as a reference. |
cols | The 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.
r | The Interfaces to use as a reference. |
|
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.
table | The table name to search in. |
s | The keys/values to match against. |
v | The keys/values to update. |