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
void class::callingMethod(int ID)
{
class2Object->getData(ID, data);
qDebug() << "Data length = " << data->length();
}
void class::callingMethod(int ID)
{
QByteArray *data = new QByteArray();
class2Object->getData(ID, data);
qDebug() << "Data length = " << data->length();
}
To copy to clipboard, switch view to plain text mode
{
// ... do query
inData = dbData;
qDebug() << "dbData Length = " << dbData->length();
qDebug() << "inData Length = " << inData->length();
}
void class2::getData(int ID, QByteArray *inData)
{
QSqlQuery query;
// ... do query
QByteArray *dbData = new QByteArray(query.value(0).toByteArray());
inData = dbData;
qDebug() << "dbData Length = " << dbData->length();
qDebug() << "inData Length = " << inData->length();
}
To copy to clipboard, switch view to plain text mode
The output is:
dbData Length = 2559219
inData Length = 2559219
Data Length = 0
Bookmarks