[odb-users] Qt BLOB Support

Boris Kolpackov boris at codesynthesis.com
Tue Oct 25 08:00:58 EDT 2011


Hi Pascal,

Pascal Stoll <past0004 at stud.fh-kl.de> writes:

> Oh i saw one main difference. Do i have to use all the QSharedPointers/qt
> lazy pointer? I was using the boost ones. Could that be the problem?

No, the kind of pointers you use should be irrelevant. I suggest that
you try this with a very simple, stand-alone test. For example, define
a persistent class like this:

#include <QtCore/QByteArray>

#pragma db object
struct test
{
  #pragma db id
  unsigned long id;

  QByteArray data;
};

And try to store it in the database and then load it back:

test o1;
o1.id = 1;
o1.data = QByteArray ("\0xF1\0x00\0x34\0x45\0x00\0xDE", 6);

{
  transaction t (db->begin ());
  db->persist (o1);
  t.commit ();
}

test o2;
{
  transaction t (db->begin ());
  db->load<test> (1, o2);
  t.commit ();
}

assert (o1.data == o2.data);

If this test works for you, then you need to see what is different
about your code. If the test doesn't work, then I will need more
information about your setup (OS, C++ compiler, database you are
using, ODB version, Qt version) so that I can try and reproduce
this.

Boris



More information about the odb-users mailing list