some work in morm

- support for fetching rows from db
- support for inserting/updating rows



git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1081 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2018-04-16 22:46:25 +00:00
parent 09f31b2803
commit 72b2622d08
17 changed files with 965 additions and 319 deletions

View File

@@ -89,6 +89,7 @@ public:
// set object to default values
virtual void clear();
protected:
ModelConnector * model_connector;
@@ -97,9 +98,16 @@ protected:
Model();
virtual ~Model();
virtual void before_select();
virtual void before_insert();
virtual void before_update();
virtual void after_select();
virtual void after_insert();
virtual void after_update();
template<typename FieldValue>
void field(const wchar_t * field_name, const FieldValue & field_value, bool insertable = true, bool updatable = true, bool is_primary_key = false)
void field(const wchar_t * field_name, FieldValue & field_value, bool insertable = true, bool updatable = true, bool is_primary_key = false)
{
if( model_connector )
{
@@ -107,9 +115,28 @@ protected:
}
}
template<typename ModelClass>
void field_list(const wchar_t * field_name, std::list<ModelClass> & field_list, bool insertable = true, bool updatable = true, bool is_primary_key = false)
{
if( model_connector )
{
model_connector->field_list(field_name, field_list, insertable, updatable, is_primary_key);
}
}
template<typename FieldValue>
void get_last_sequence(const wchar_t * sequence_table_name, FieldValue & field_value)
{
if( model_connector )
{
model_connector->get_last_sequence(sequence_table_name, field_value);
}
}
//void field(const wchar_t * field_name, Model & field, bool insertable = true, bool updatable = true);
template<typename ModelClass> friend class Finder;
friend class ModelConnector;
};
} // namespace