added support for UPDATE, INSERT and REMOVE for lists childs

(need some testing)




git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1214 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2019-09-24 11:09:11 +00:00
parent a5d5a81a57
commit cff4c1518e
3 changed files with 108 additions and 45 deletions

View File

@@ -69,8 +69,10 @@ public:
std::wstring email;
Language language;
std::list<Attachment> attachments;
Attachment attachment;
void map_fields()
{
field(L"id", id, false, false, true);
@@ -81,7 +83,9 @@ public:
field(L"email", email);
field(L"language_id", L"language", language);
field(L"person_id", L"attachment", attachment, true, true, false);
field(L"person_id", L"attachments", attachments);
//field(L"person_id", L"attachment", attachment, true, true, false);
//field(L"person_id", attachment, f::insertable | f::updatable | f::foreign_key);
//field(L"person_id", attachment, f::insertable, f::updatable, f::foreign_key);
}
@@ -92,6 +96,12 @@ public:
stream << "public.person";
}
void after_select()
{
morm::Finder<Attachment> finder(model_connector);
attachments = finder.select().where().eq(L"person_id", id).get_list();
}
void after_insert()
{
get_last_sequence(L"public.person_id_seq", id);