Hello,

I am having some very weird problems passing a QByteArray* to a method to retrieve BLOB data from a SQL DB. When I check the length of the QByteArray* in the method it is the size I expect, when I check it outside the method it is zero. Does anybody have any suggestions. This is probably something simple and I've just been working too long today


Qt Code:
  1. void class::callingMethod(int ID)
  2. {
  3. QByteArray *data = new QByteArray();
  4. class2Object->getData(ID, data);
  5. qDebug() << "Data length = " << data->length();
  6. }
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. void class2::getData(int ID, QByteArray *inData)
  2. {
  3. QSqlQuery query;
  4. // ... do query
  5.  
  6. QByteArray *dbData = new QByteArray(query.value(0).toByteArray());
  7. inData = dbData;
  8.  
  9. qDebug() << "dbData Length = " << dbData->length();
  10. qDebug() << "inData Length = " << inData->length();
  11. }
To copy to clipboard, switch view to plain text mode 
The output is:

dbData Length = 2559219
inData Length =
2559219
Data Length = 0