LiteSQL
|
An abstract base class of persistents objects. More...
#include <persistent.hpp>
Public Member Functions | |
const Database & | getDatabase () const |
returns reference to Database the object is in | |
bool | isInDatabase () const |
returns true if object is in database | |
const Persistent & | operator= (const Persistent &p) |
copies values and keeps fields unchanged | |
Persistent (const Persistent &p) | |
copies values and registers Field-objects to fields | |
Persistent (const Database &_db, const Record &row) | |
Persistent (const Database &_db) | |
creates empty Persistent | |
virtual void | onDelete () |
virtual | ~Persistent () |
empty | |
Static Public Member Functions | |
static std::vector< std::string > | getTablesFromFieldTypes (const std::vector< FieldType > &fdatas) |
selectObjectQuery uses this to list tables used by Persistent More... | |
Protected Types | |
typedef std::map< std::string, std::vector< pair< FieldType, std::string > > > | Updates |
Protected Member Functions | |
std::string | insert (Record &tables, Records &fieldRecs, Records &values, const std::string &sequence) |
executed when object is created into database | |
void | update (const Updates &updates) |
template<class T > | |
void | updateField (litesql::Persistent::Updates &updates, const std::string &table, litesql::Field< T > fld) |
void | prepareUpdate (Updates &updates, const std::string &table) |
void | deleteFromTable (const std::string &table, const std::string &id) |
Protected Attributes | |
const Database * | db |
pointer to current Database Persistent is assigned to. More... | |
bool | inDatabase |
flag that indicates that object is stored in some database. More... | |
int | oldKey |
used to keep track of ID changes. More... | |
An abstract base class of persistents objects.
|
static |
selectObjectQuery uses this to list tables used by Persistent
fdatas | field information |
|
protected |
pointer to current Database Persistent is assigned to.
It is not a reference because Persistents must be assignable using operator=
Referenced by getDatabase(), insert(), and operator=().
|
protected |
flag that indicates that object is stored in some database.
It might be more accurate to use pointer in stead of boolean.
Referenced by insert(), isInDatabase(), and operator=().
|
protected |
used to keep track of ID changes.
When user changes Persistent object's identifier (ID, field 0), record has to be upcasted to change row id of all tables of object
Referenced by insert(), and operator=().