[odb-users] Re: Problem loading long TEXT strings with MySQL

Andreas Gerasch gerasch at informatik.uni-tuebingen.de
Fri Feb 10 03:19:37 EST 2012


Hi Boris,

> In the future please keep your replies CC'ed to the odb-users mailing
> list, again, as discussed in the posting guidelines:

sorry, for that - I just missed the reply all button.

 > I just tried to change the line 31 in hello/driver.cxx:
 >
 > person jane ("Jane", "Doe", 32);
 >
 > To read:
 >
 > person jane ("Jan" + string (512, 'n') + 'e', "Doe", 32);
 >
 > I then ran the test (make check) and I see the correct, full string
 > being printed. Can you try this and see if it works for you?

After using the odb-examples.tar.gz, I was able to reproduce the problem 
using your hello example by introducing a vector of middle names.

In person.hxx, I added a private field

	std::vector<std::string> middle_;

and two public methods

   void
   add_middle(std::string m)
   {
     middle_.push_back(m);
   }

   std::vector<std::string>
   get_middle()
   {
     return middle_;
   }

In driver.cxx I added the lines

   john.add_middle(string(512, 'n'));
   jane.add_middle("Janette");
   joe.add_middle("Dalton");

and changed the output to

   cout << "Hello, " << i->first () << " " << i->get_middle()[0] << " " 
<< i->last () << "!" << endl;


After persisting the objects, I changed the code and loaded the data 
only by querying all persons. Then I got this result:

Hello, John 
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn1</aliasJohnn 
name="latin1_german1_ci"	id="5"	order="German Duden"/>
   <collation name="latin1_swedish_ci"	id="8"	order="Finnish, Swedish">
     <flag>primary</flag>
     <flag>compiled</flag>
   </collation>
   <collation name="latin1_danish_ci"	id=" Doe!
Hello, Jane Janette Doe!
Hello, Joe Dalton Dirt!

Note, the problem occurs only, if we have long strings in a vector 
(other containers not tested).

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: driver.cxx
Type: text/x-c++src
Size: 1641 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20120210/6e4bff6b/driver.cxx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: person.hxx
Type: text/x-c++hdr
Size: 1363 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20120210/6e4bff6b/person.hxx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gerasch.vcf
Type: text/x-vcard
Size: 435 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20120210/6e4bff6b/gerasch.vcf


More information about the odb-users mailing list