0 Replies Latest reply: Sep 10, 2013 11:02 AM by deca2779-92cd-46ac-8e6a-17327ad932ff RSS

    dbstl vector _DB_STL_StoreElement InvalidFunctionCall




      I use version 6.0.20


      I made a very short example in which I have : a DbEnv (DB_CXX_NO_EXCEPTIONS, DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL | DB_THREAD), a Db (DB_CREATE | DB_THREAD, DB_RECNO, DB_RENUMBER), and a db_vector, which contains objects consisting of : a struct timeval (two integers), and a std::string. I wrote 3 functions to compute size, and to un/marshal this type as stated in Dbstl persistence


      My example pushes some data in my vector, then iterate through all elements to print them, then modidy, the first, then iterate again to show the modification.


      Everything goes fine but for the modifying part which I wrote as follows, according to Dbstl persistence (:

      typedef dbstl::db_vector<News> TNewsDb;  
      TNewsDb::value_type_wrap & last = data.rbegin();
      last._data = "j'apprecie les fruits au sirop";
      last._DB_STL_StoreElement(); // Contrary to what doc says, this does not work (InvalidFunctionCall)

      The doc states to use contain::value_type, but this does not even compile as this type aliases News and not ElementRef<News>. So I changed it for value_type_wrap.


      This does not work either. Upon execution I get this error:

      terminate called after throwing an instance of 'dbstl::InvalidFunctionCall'
      db_base_iterator<>::replace_current can't be called


      Can somebody point me to what I am doing wrong here ?


      Any hint would be appreciated,