diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-24 16:37:09 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-11-24 16:37:09 +0200 |
commit | e7892161b62d0f7f2ccf984d163a91025a3ddf78 (patch) | |
tree | 53b4ed2934df81071e5cf6b4fb44568bcf487522 /odb/mysql/header.cxx | |
parent | 19ba163feb74def218861b4b3981e713b358d1c8 (diff) |
Implement support for many-to-{one,many} inverse relationships
Diffstat (limited to 'odb/mysql/header.cxx')
-rw-r--r-- | odb/mysql/header.cxx | 77 |
1 files changed, 42 insertions, 35 deletions
diff --git a/odb/mysql/header.cxx b/odb/mysql/header.cxx index 119219a..89b1fe8 100644 --- a/odb/mysql/header.cxx +++ b/odb/mysql/header.cxx @@ -245,6 +245,7 @@ namespace mysql type* kt (0); bool ordered (false); + bool inverse (context::inverse (m, "value")); switch (ck) { @@ -520,33 +521,36 @@ namespace mysql // init (data_image) // - os << "static void" << endl; - - switch (ck) + if (!inverse) { - case ck_ordered: + os << "static void" << endl; + + switch (ck) { - if (ordered) - os << "init (data_image_type&, index_type, const value_type&);"; - else + case ck_ordered: + { + if (ordered) + os << "init (data_image_type&, index_type, const value_type&);"; + else + os << "init (data_image_type&, const value_type&);"; + break; + } + case ck_map: + case ck_multimap: + { + os << "init (data_image_type&, const key_type&, const value_type&);"; + break; + } + case ck_set: + case ck_multiset: + { os << "init (data_image_type&, const value_type&);"; - break; - } - case ck_map: - case ck_multimap: - { - os << "init (data_image_type&, const key_type&, const value_type&);"; - break; - } - case ck_set: - case ck_multiset: - { - os << "init (data_image_type&, const value_type&);"; - break; + break; + } } - } - os << endl; + os << endl; + } // init (data) // @@ -641,11 +645,12 @@ namespace mysql // persist // - os << "static void" << endl - << "persist (const container_type&," << endl - << "id_image_type&," << endl - << "statements_type&);" - << endl; + if (!inverse) + os << "static void" << endl + << "persist (const container_type&," << endl + << "id_image_type&," << endl + << "statements_type&);" + << endl; // load // @@ -657,17 +662,19 @@ namespace mysql // update // - os << "static void" << endl - << "update (const container_type&," << endl - << "id_image_type&," << endl - << "statements_type&);" - << endl; + if (!inverse) + os << "static void" << endl + << "update (const container_type&," << endl + << "id_image_type&," << endl + << "statements_type&);" + << endl; // erase // - os << "static void" << endl - << "erase (id_image_type&, statements_type&);" - << endl; + if (!inverse) + os << "static void" << endl + << "erase (id_image_type&, statements_type&);" + << endl; os << "};"; } |