added support for new morm api
- field(...) methods from Model take now FT structure instead of insertable/updatable/primary_key boolean flags - table name is set in a prepare_table() method now - added meta and admin_meta from ItemContent (morm has a field() method with PT::Space argument now)
This commit is contained in:
parent
e8ba2a7bd1
commit
bbc0a67153
|
@ -282,6 +282,7 @@ bool App::Init()
|
||||||
|
|
||||||
model_connector.set_flat_connector(json_connector);
|
model_connector.set_flat_connector(json_connector);
|
||||||
model_connector.set_db_connector(postgresql_connector);
|
model_connector.set_db_connector(postgresql_connector);
|
||||||
|
model_connector.set_logger(log);
|
||||||
//model_connector.set_doc_connector(doc_html_connector);
|
//model_connector.set_doc_connector(doc_html_connector);
|
||||||
|
|
||||||
// temporary
|
// temporary
|
||||||
|
|
|
@ -56,23 +56,23 @@ void Item::map_fields()
|
||||||
|
|
||||||
int type_helper = static_cast<int>(type);
|
int type_helper = static_cast<int>(type);
|
||||||
|
|
||||||
field(L"id", id, false, false, true);
|
field(L"id", id, morm::FT::no_insertable | morm::FT::no_updatable | morm::FT::primary_key);
|
||||||
field(L"parent_id", parent_id);
|
field(L"parent_id", parent_id);
|
||||||
field(L"type", type_helper);
|
field(L"type", type_helper);
|
||||||
field(L"url", url);
|
field(L"url", url);
|
||||||
field(L"subject", subject);
|
field(L"subject", subject);
|
||||||
field(L"template", html_template);
|
field(L"template", html_template);
|
||||||
field(L"sort_index", sort_index);
|
field(L"sort_index", sort_index);
|
||||||
field(L"content_id", item_content, true, true, true);
|
field(L"content_id", item_content, morm::FT::foreign_key);
|
||||||
|
|
||||||
// may we should add a method setTypeFromInt(int t)?
|
// may we should add a method setTypeFromInt(int t)?
|
||||||
type = static_cast<Type>(type_helper);
|
type = static_cast<Type>(type_helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Item::table_name(PT::TextStream & stream)
|
void Item::prepare_table()
|
||||||
{
|
{
|
||||||
stream << "core.item";
|
table(L"core", L"item");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ public:
|
||||||
Item();
|
Item();
|
||||||
|
|
||||||
void map_fields();
|
void map_fields();
|
||||||
void table_name(PT::TextStream & stream);
|
void prepare_table();
|
||||||
void before_insert();
|
void before_insert();
|
||||||
void after_insert();
|
void after_insert();
|
||||||
|
|
||||||
|
|
|
@ -50,20 +50,13 @@ ItemContent::ItemContent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// IMPROVEME move me to morm
|
|
||||||
void ItemContent::field(const wchar_t * db_field_name, PT::Space & space)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ItemContent::map_fields()
|
void ItemContent::map_fields()
|
||||||
{
|
{
|
||||||
int content_raw_type_helper = static_cast<int>(content_raw_type);
|
int content_raw_type_helper = static_cast<int>(content_raw_type);
|
||||||
int content_parsed_type_helper = static_cast<int>(content_parsed_type);
|
int content_parsed_type_helper = static_cast<int>(content_parsed_type);
|
||||||
|
|
||||||
field(L"id", id, false, false, true);
|
field(L"id", id, morm::FT::no_insertable | morm::FT::no_updatable | morm::FT::primary_key);
|
||||||
field(L"references", references);
|
field(L"references", references);
|
||||||
field(L"user_id", user_id);
|
field(L"user_id", user_id);
|
||||||
field(L"group_id", group_id);
|
field(L"group_id", group_id);
|
||||||
|
@ -85,17 +78,17 @@ void ItemContent::map_fields()
|
||||||
field(L"content_raw_type", content_raw_type_helper);
|
field(L"content_raw_type", content_raw_type_helper);
|
||||||
field(L"content_parsed", content_parsed);
|
field(L"content_parsed", content_parsed);
|
||||||
field(L"content_parsed_type", content_parsed_type_helper);
|
field(L"content_parsed_type", content_parsed_type_helper);
|
||||||
// field(L"meta", meta);
|
field(L"meta", meta);
|
||||||
// field(L"meta_admin", meta_admin);
|
field(L"meta_admin", meta_admin);
|
||||||
|
|
||||||
content_raw_type = static_cast<ContentType>(content_raw_type_helper);
|
content_raw_type = static_cast<ContentType>(content_raw_type_helper);
|
||||||
content_parsed_type = static_cast<ContentType>(content_parsed_type_helper);
|
content_parsed_type = static_cast<ContentType>(content_parsed_type_helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ItemContent::table_name(PT::TextStream & stream)
|
void ItemContent::prepare_table()
|
||||||
{
|
{
|
||||||
stream << "core.content";
|
table(L"core", L"content");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ public:
|
||||||
ItemContent();
|
ItemContent();
|
||||||
|
|
||||||
void map_fields();
|
void map_fields();
|
||||||
void table_name(PT::TextStream & stream);
|
void prepare_table();
|
||||||
void after_insert();
|
void after_insert();
|
||||||
|
|
||||||
|
|
||||||
|
@ -231,9 +231,6 @@ public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// IMPROVEME move me to morm
|
|
||||||
using morm::Model::field;
|
|
||||||
void field(const wchar_t * db_field_name, PT::Space & space);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -351,10 +351,10 @@ init.o: ../../../../winix/winixd/core/winixbase.h
|
||||||
init.o: ../../../../morm/src/modelconnector.h ../../../../morm/src/clearer.h
|
init.o: ../../../../morm/src/modelconnector.h ../../../../morm/src/clearer.h
|
||||||
init.o: ../../../../pikotools/date/date.h
|
init.o: ../../../../pikotools/date/date.h
|
||||||
init.o: ../../../../pikotools/convert/inttostr.h
|
init.o: ../../../../pikotools/convert/inttostr.h
|
||||||
init.o: ../../../../morm/src/dbconnector.h
|
|
||||||
init.o: ../../../../pikotools/textstream/textstream.h
|
|
||||||
init.o: ../../../../pikotools/space/space.h
|
init.o: ../../../../pikotools/space/space.h
|
||||||
init.o: ../../../../pikotools/textstream/types.h
|
init.o: ../../../../pikotools/textstream/types.h
|
||||||
|
init.o: ../../../../morm/src/dbconnector.h
|
||||||
|
init.o: ../../../../pikotools/textstream/textstream.h
|
||||||
init.o: ../../../../pikotools/membuffer/membuffer.h
|
init.o: ../../../../pikotools/membuffer/membuffer.h
|
||||||
init.o: ../../../../pikotools/textstream/types.h
|
init.o: ../../../../pikotools/textstream/types.h
|
||||||
init.o: ../../../../pikotools/log/log.h ../../../../pikotools/log/filelog.h
|
init.o: ../../../../pikotools/log/log.h ../../../../pikotools/log/filelog.h
|
||||||
|
|
|
@ -254,9 +254,9 @@ init.o: ../../../../winix/winixd/core/winixbase.h
|
||||||
init.o: ../../../../morm/src/modelconnector.h ../../../../morm/src/clearer.h
|
init.o: ../../../../morm/src/modelconnector.h ../../../../morm/src/clearer.h
|
||||||
init.o: ../../../../pikotools/date/date.h
|
init.o: ../../../../pikotools/date/date.h
|
||||||
init.o: ../../../../pikotools/convert/inttostr.h
|
init.o: ../../../../pikotools/convert/inttostr.h
|
||||||
|
init.o: ../../../../pikotools/space/space.h
|
||||||
init.o: ../../../../morm/src/dbconnector.h
|
init.o: ../../../../morm/src/dbconnector.h
|
||||||
init.o: ../../../../pikotools/textstream/textstream.h
|
init.o: ../../../../pikotools/textstream/textstream.h
|
||||||
init.o: ../../../../pikotools/space/space.h
|
|
||||||
init.o: ../../../../pikotools/membuffer/membuffer.h
|
init.o: ../../../../pikotools/membuffer/membuffer.h
|
||||||
init.o: ../../../../pikotools/textstream/types.h
|
init.o: ../../../../pikotools/textstream/types.h
|
||||||
init.o: ../../../../pikotools/log/log.h ../../../../pikotools/log/filelog.h
|
init.o: ../../../../pikotools/log/log.h ../../../../pikotools/log/filelog.h
|
||||||
|
|
|
@ -287,10 +287,10 @@ init.o: ../../../../winix/winixd/core/winixbase.h
|
||||||
init.o: ../../../../morm/src/modelconnector.h ../../../../morm/src/clearer.h
|
init.o: ../../../../morm/src/modelconnector.h ../../../../morm/src/clearer.h
|
||||||
init.o: ../../../../pikotools/date/date.h
|
init.o: ../../../../pikotools/date/date.h
|
||||||
init.o: ../../../../pikotools/convert/inttostr.h
|
init.o: ../../../../pikotools/convert/inttostr.h
|
||||||
init.o: ../../../../morm/src/dbconnector.h
|
|
||||||
init.o: ../../../../pikotools/textstream/textstream.h
|
|
||||||
init.o: ../../../../pikotools/space/space.h
|
init.o: ../../../../pikotools/space/space.h
|
||||||
init.o: ../../../../pikotools/textstream/types.h
|
init.o: ../../../../pikotools/textstream/types.h
|
||||||
|
init.o: ../../../../morm/src/dbconnector.h
|
||||||
|
init.o: ../../../../pikotools/textstream/textstream.h
|
||||||
init.o: ../../../../pikotools/membuffer/membuffer.h
|
init.o: ../../../../pikotools/membuffer/membuffer.h
|
||||||
init.o: ../../../../pikotools/textstream/types.h
|
init.o: ../../../../pikotools/textstream/types.h
|
||||||
init.o: ../../../../pikotools/log/log.h ../../../../pikotools/log/filelog.h
|
init.o: ../../../../pikotools/log/log.h ../../../../pikotools/log/filelog.h
|
||||||
|
|
Loading…
Reference in New Issue