AW: [odb-users] Qt BLOB Support

Pascal Stoll past0004 at
Wed Oct 26 09:41:22 EDT 2011

Sry for the late response, but there where some other stuff to do first.
I made your test. The assert does nothing, but ich checked the size of both values. was 6 and 0. So same problem. It writes the blob correct into the database, but when i try to read it out, it is always null.
Von: Boris Kolpackov [boris at]
Gesendet: Dienstag, 25. Oktober 2011 14:00
Bis: Pascal Stoll
Cc: odb-users at
Betreff: Re: [odb-users] Qt BLOB Support

Hi Pascal,

Pascal Stoll <past0004 at> 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; = 1; = 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 ( ==;

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


More information about the odb-users mailing list