Changeset 180
- Timestamp:
- 09/01/08 11:27:21 (4 months ago)
- Files:
-
- trunk/dba/dba/xmlostream.cpp (modified) (1 diff)
- trunk/dba/test/main.cpp (modified) (1 diff)
- trunk/dba/test/xmltestcase.cpp (modified) (2 diffs)
- trunk/dba/test/xmltestcase.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dba/dba/xmlostream.cpp
r175 r180 232 232 if (iterator->hasNext()) { 233 233 if (pMember.getFKeyName() != NULL) { 234 xmlAddChild(mParentNode, createNode(pMember.getFKeyName())); 235 mParentNode = mParentNode->children; 234 mParentNode = xmlAddChild(mParentNode, createNode(pMember.getFKeyName())); 236 235 }; 237 236 while(iterator->hasNext()) { trunk/dba/test/main.cpp
r176 r180 151 151 //runner.addTest(new CppUnit::TestCaller<SQLite3SQLArchiveTestCase>("debug_test",&SQLite3SQLArchiveTestCase::transactions_rollback)); 152 152 //runner.addTest(dba_tests::XMLTestCase::suite()); 153 //runner.addTest(new CppUnit::TestCaller<dba_tests::XMLTestCase>("debug_test",&dba_tests::XMLTestCase::storeBug 2));153 //runner.addTest(new CppUnit::TestCaller<dba_tests::XMLTestCase>("debug_test",&dba_tests::XMLTestCase::storeBug3)); 154 154 //runner.addTest(new CppUnit::TestCaller<dba_tests::XMLTestCase>("debug_test",&dba_tests::XMLTestCase::store_two)); 155 155 //runner.addTest(new CppUnit::TestCaller<OdbcPluginTestCase>("debug_test",&OdbcPluginTestCase::dbConnection)); trunk/dba/test/xmltestcase.cpp
r175 r180 19 19 #include "dba/stdlist.h" 20 20 #include "dba/single.h" 21 #include "dba/bool_filter.h" 21 22 22 23 #include <fstream> … … 958 959 }; 959 960 961 struct StoreBug3A : public dba::Storeable { 962 DECLARE_STORE_TABLE(); 963 }; 964 BEGIN_STORE_TABLE(StoreBug3A, dba::Storeable, "ris_examparamval") 965 END_STORE_TABLE() 966 967 struct StoreBug3B : public dba::Storeable { 968 StoreBug3B() : mIsRemoved(false) {}; 969 bool mIsRemoved; 970 DECLARE_STORE_TABLE(); 971 }; 972 BEGIN_STORE_TABLE(StoreBug3B, dba::Storeable, NULL) 973 BIND_INT(mIsRemoved, dba::Bool, "is_removed") 974 END_STORE_TABLE() 975 976 struct StoreBug3C : public dba::Storeable { 977 StoreBug3C() { 978 for (int i=0; i<2; ++i) 979 mVals.push_back(StoreBug3A()); 980 } 981 DECLARE_STORE_TABLE(); 982 StoreBug3B mRemoveable; 983 std::list<StoreBug3A> mVals; 984 }; 985 BEGIN_STORE_TABLE(StoreBug3C, dba::Storeable, "ris_examparam") 986 BIND_STB(StoreBug3C::mRemoveable) 987 BIND_COL(StoreBug3C::mVals, dba::stdList<StoreBug3A>, "examparam_id") 988 END_STORE_TABLE() 989 990 void 991 XMLTestCase::storeBug3() { 992 /* bug: the result is: 993 <?xml version="1.0" encoding="utf-8"?> 994 <ris_examparam> 995 <is_removed> 996 <ris_examparamval/> 997 <ris_examparamval/> 998 0 999 </is_removed> 1000 <examparam_id/> 1001 </ris_examparam> 1002 */ 1003 1004 const char* result = 1005 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" 1006 "<ris_examparam>\n" 1007 " <is_removed>0</is_removed>\n" 1008 " <examparam_id>\n" 1009 " <ris_examparamval/>\n" 1010 " <ris_examparamval/>\n" 1011 " </examparam_id>\n" 1012 "</ris_examparam>\n" 1013 ; 1014 { 1015 dba::XMLArchive ar; 1016 ar.setRootNodeName(NULL); 1017 ar.useElements(); 1018 unlink("storebug3.xml"); 1019 ar.open("storebug3.xml"); 1020 StoreBug3C obj; 1021 dba::XMLOStream stream(ar.getOStream()); 1022 stream.enableDebug(); 1023 stream.open(); 1024 stream.put(&obj); 1025 } 1026 CPPUNIT_ASSERT(compareXML("storebug3.xml",result)); 1027 }; 1028 1029 960 1030 } //namespace 961 1031 trunk/dba/test/xmltestcase.h
r175 r180 54 54 CPPUNIT_TEST(storeToElements); 55 55 CPPUNIT_TEST(storeBug2); 56 CPPUNIT_TEST(storeBug3); 56 57 CPPUNIT_TEST_SUITE_END(); 57 58 public: … … 92 93 void storeBug1(); 93 94 void storeBug2(); 95 void storeBug3(); 94 96 private: 95 97 bool compareXML(const char* pFilename, const char* pData);
