Changeset 180

Show
Ignore:
Timestamp:
09/01/08 11:27:21 (4 months ago)
Author:
zork
Message:

list elements was added to first element member instead of list node

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dba/dba/xmlostream.cpp

    r175 r180  
    232232    if (iterator->hasNext()) { 
    233233      if (pMember.getFKeyName() != NULL) { 
    234         xmlAddChild(mParentNode, createNode(pMember.getFKeyName())); 
    235         mParentNode = mParentNode->children; 
     234        mParentNode = xmlAddChild(mParentNode, createNode(pMember.getFKeyName())); 
    236235      }; 
    237236      while(iterator->hasNext()) { 
  • trunk/dba/test/main.cpp

    r176 r180  
    151151  //runner.addTest(new CppUnit::TestCaller<SQLite3SQLArchiveTestCase>("debug_test",&SQLite3SQLArchiveTestCase::transactions_rollback)); 
    152152  //runner.addTest(dba_tests::XMLTestCase::suite()); 
    153   //runner.addTest(new CppUnit::TestCaller<dba_tests::XMLTestCase>("debug_test",&dba_tests::XMLTestCase::storeBug2)); 
     153  //runner.addTest(new CppUnit::TestCaller<dba_tests::XMLTestCase>("debug_test",&dba_tests::XMLTestCase::storeBug3)); 
    154154  //runner.addTest(new CppUnit::TestCaller<dba_tests::XMLTestCase>("debug_test",&dba_tests::XMLTestCase::store_two)); 
    155155  //runner.addTest(new CppUnit::TestCaller<OdbcPluginTestCase>("debug_test",&OdbcPluginTestCase::dbConnection)); 
  • trunk/dba/test/xmltestcase.cpp

    r175 r180  
    1919#include "dba/stdlist.h" 
    2020#include "dba/single.h" 
     21#include "dba/bool_filter.h" 
    2122 
    2223#include <fstream> 
     
    958959}; 
    959960 
     961struct StoreBug3A : public dba::Storeable { 
     962  DECLARE_STORE_TABLE(); 
     963};  
     964BEGIN_STORE_TABLE(StoreBug3A, dba::Storeable, "ris_examparamval") 
     965END_STORE_TABLE() 
     966 
     967struct StoreBug3B : public dba::Storeable { 
     968  StoreBug3B() : mIsRemoved(false) {}; 
     969  bool mIsRemoved; 
     970  DECLARE_STORE_TABLE(); 
     971}; 
     972BEGIN_STORE_TABLE(StoreBug3B, dba::Storeable, NULL) 
     973BIND_INT(mIsRemoved, dba::Bool, "is_removed") 
     974END_STORE_TABLE() 
     975 
     976struct 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}; 
     985BEGIN_STORE_TABLE(StoreBug3C, dba::Storeable, "ris_examparam") 
     986BIND_STB(StoreBug3C::mRemoveable) 
     987BIND_COL(StoreBug3C::mVals, dba::stdList<StoreBug3A>, "examparam_id") 
     988END_STORE_TABLE() 
     989 
     990void 
     991XMLTestCase::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 
    9601030} //namespace 
    9611031 
  • trunk/dba/test/xmltestcase.h

    r175 r180  
    5454      CPPUNIT_TEST(storeToElements); 
    5555      CPPUNIT_TEST(storeBug2); 
     56      CPPUNIT_TEST(storeBug3); 
    5657    CPPUNIT_TEST_SUITE_END(); 
    5758  public: 
     
    9293    void storeBug1(); 
    9394    void storeBug2(); 
     95    void storeBug3(); 
    9496  private: 
    9597    bool compareXML(const char* pFilename, const char* pData);