42 namespace database_interface {
96 for (
size_t t=0; t<
fields_.size(); t++)
113 std::map<std::string, DBFieldBase*>::const_iterator it;
128 for (
size_t i=0; i<
fields_.size(); i++)
130 fields_[i]->setReadFromDatabase(sync);
137 for (
size_t i=0; i<
fields_.size(); i++)
139 fields_[i]->setWriteToDatabase(sync);
void setWriteToDatabase(bool sync)
std::map< std::string, DBFieldBase * > foreign_keys_
List of foreign keys in OTHER tables that reference our PRIMARY KEY.
bool getForeignKey(std::string table, DBFieldBase *&key)
bool getForeignKey(std::string table, const DBFieldBase *&key) const
Returns the name of the foreign key column in a given table that references our primary key...
void setReadFromDatabase(bool sync)
const DBFieldBase * getField(size_t i) const
const DBFieldBase * getPrimaryKeyField() const
The base class for a field of a class stored in the database, corresponding to a column in a table...
The base class for all C++ classes that can be stored in the database.
DBClass & operator=(const DBClass &rhs)
Makes the class non-assignable.
size_t getNumFields() const
std::string getName() const
DBFieldBase * getField(size_t i)
void setAllFieldsReadFromDatabase(bool sync)
void setAllFieldsWriteToDatabase(bool sync)
const DBFieldBase * getField(std::string name) const
std::vector< DBFieldBase * > fields_
The addresses of all the other fields.
DBFieldBase * getField(std::string name)
DBFieldBase * primary_key_field_
The address of the field that acts as a primary key.
DBFieldBase * getPrimaryKeyField()