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:
31
src/model.h
31
src/model.h
@@ -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
|
||||
|
Reference in New Issue
Block a user