| | 1030 | struct bug4_A : public dba::Storeable { |
|---|
| | 1031 | DECLARE_STORE_TABLE(); |
|---|
| | 1032 | }; |
|---|
| | 1033 | BEGIN_STORE_TABLE(bug4_A, dba::Storeable, "A") |
|---|
| | 1034 | END_STORE_TABLE() |
|---|
| | 1035 | |
|---|
| | 1036 | struct bug4_B : public dba::Storeable { |
|---|
| | 1037 | DECLARE_STORE_TABLE(); |
|---|
| | 1038 | }; |
|---|
| | 1039 | BEGIN_STORE_TABLE(bug4_B, dba::Storeable, "B") |
|---|
| | 1040 | END_STORE_TABLE() |
|---|
| | 1041 | |
|---|
| | 1042 | struct bug4_B_Full : public bug4_B { |
|---|
| | 1043 | std::list<bug4_A> mAItems; |
|---|
| | 1044 | DECLARE_STORE_TABLE(); |
|---|
| | 1045 | }; |
|---|
| | 1046 | BEGIN_STORE_TABLE(bug4_B_Full, bug4_B, "B") |
|---|
| | 1047 | BIND_COL(bug4_B_Full::mAItems, dba::stdList<bug4_A>, NULL) |
|---|
| | 1048 | END_STORE_TABLE() |
|---|
| | 1049 | |
|---|
| | 1050 | struct bug4_C : public dba::Storeable { |
|---|
| | 1051 | bug4_B_Full mB; |
|---|
| | 1052 | DECLARE_STORE_TABLE(); |
|---|
| | 1053 | }; |
|---|
| | 1054 | BEGIN_STORE_TABLE(bug4_C, dba::Storeable, "C") |
|---|
| | 1055 | BIND_COL(mB, dba::Single, NULL) |
|---|
| | 1056 | END_STORE_TABLE() |
|---|
| | 1057 | |
|---|
| | 1058 | struct bug4_D : public dba::Storeable { |
|---|
| | 1059 | bug4_D() { |
|---|
| | 1060 | bug4_C c1; |
|---|
| | 1061 | bug4_A c1a1; |
|---|
| | 1062 | bug4_A c1a2; |
|---|
| | 1063 | c1.mB.mAItems.push_back(c1a1); |
|---|
| | 1064 | c1.mB.mAItems.push_back(c1a2); |
|---|
| | 1065 | mCItems.push_back(c1); |
|---|
| | 1066 | bug4_C c2; |
|---|
| | 1067 | mCItems.push_back(c2); |
|---|
| | 1068 | bug4_C c3; |
|---|
| | 1069 | mCItems.push_back(c3); |
|---|
| | 1070 | } |
|---|
| | 1071 | std::list<bug4_C> mCItems; |
|---|
| | 1072 | DECLARE_STORE_TABLE(); |
|---|
| | 1073 | }; |
|---|
| | 1074 | BEGIN_STORE_TABLE(bug4_D, dba::Storeable, "D") |
|---|
| | 1075 | BIND_COL(mCItems, dba::stdList<bug4_C>, NULL) |
|---|
| | 1076 | END_STORE_TABLE() |
|---|
| | 1077 | |
|---|
| | 1078 | void |
|---|
| | 1079 | XMLTestCase::storeBug4() { |
|---|
| | 1080 | /* bug: the result is: |
|---|
| | 1081 | <D> |
|---|
| | 1082 | <C> |
|---|
| | 1083 | <C> |
|---|
| | 1084 | <B/> |
|---|
| | 1085 | </C> |
|---|
| | 1086 | <C> |
|---|
| | 1087 | <B/> |
|---|
| | 1088 | </C> |
|---|
| | 1089 | <B> |
|---|
| | 1090 | <A/> |
|---|
| | 1091 | <A/> |
|---|
| | 1092 | </B> |
|---|
| | 1093 | </C> |
|---|
| | 1094 | </D> |
|---|
| | 1095 | */ |
|---|
| | 1096 | |
|---|
| | 1097 | /** |
|---|
| | 1098 | Note: the problem is caused by the fact that B is splitted (bug3_B & bug3_B_Full) |
|---|
| | 1099 | */ |
|---|
| | 1100 | |
|---|
| | 1101 | const char* result = |
|---|
| | 1102 | "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" |
|---|
| | 1103 | "<D>\n" |
|---|
| | 1104 | " <C>\n" |
|---|
| | 1105 | " <B/>\n" |
|---|
| | 1106 | " </C>\n" |
|---|
| | 1107 | " <C>\n" |
|---|
| | 1108 | " <B/>\n" |
|---|
| | 1109 | " </C>\n" |
|---|
| | 1110 | " <C>\n" |
|---|
| | 1111 | " <B>\n" |
|---|
| | 1112 | " <A/>\n" |
|---|
| | 1113 | " <A/>\n" |
|---|
| | 1114 | " </B>\n" |
|---|
| | 1115 | " </C>\n" |
|---|
| | 1116 | "</D>\n" |
|---|
| | 1117 | ; |
|---|
| | 1118 | { |
|---|
| | 1119 | dba::XMLArchive ar; |
|---|
| | 1120 | ar.setRootNodeName(NULL); |
|---|
| | 1121 | ar.useElements(); |
|---|
| | 1122 | bug4_D obj; |
|---|
| | 1123 | unlink("storebug4.xml"); |
|---|
| | 1124 | ar.open("storebug4.xml"); |
|---|
| | 1125 | dba::XMLOStream stream(ar.getOStream()); |
|---|
| | 1126 | stream.enableDebug(); |
|---|
| | 1127 | stream.open(); |
|---|
| | 1128 | stream.put(&obj); |
|---|
| | 1129 | } |
|---|
| | 1130 | CPPUNIT_ASSERT(compareXML("storebug4.xml",result)); |
|---|
| | 1131 | }; |
|---|
| | 1132 | |
|---|
| | 1133 | |
|---|