herrmarder
28th January 2010, 13:04
I am not an expert SQL user and I do not have much experience with the QtSql Module, I hope I am not missing something obvious:
I want to retrieve a list of blobs from my (sqlite) database with a batch command. But it does not work properly. isSelect() is not true for the query and I cannot get the results of the query.
Am I using the command correctly? Or should I simply do consecutive exec() commands. Will that have an effect on the speed?
Here is my sample code:
QString query_string = QString(
"SELECT my_blob_column FROM my_table WHERE id = ? ;"
);
q.prepare(query_string);
q.addBindValue(ids_in_qvariantlist);
if (!q.execBatch()) {...}
qDebug() << q.isSelect(); // is false
while (q.next()) { // is never true
qDebug() << q.value(0).toByteArray()
}
edit:
I am running Qt 4.5.3 on OpenSuse 11.2
I want to retrieve a list of blobs from my (sqlite) database with a batch command. But it does not work properly. isSelect() is not true for the query and I cannot get the results of the query.
Am I using the command correctly? Or should I simply do consecutive exec() commands. Will that have an effect on the speed?
Here is my sample code:
QString query_string = QString(
"SELECT my_blob_column FROM my_table WHERE id = ? ;"
);
q.prepare(query_string);
q.addBindValue(ids_in_qvariantlist);
if (!q.execBatch()) {...}
qDebug() << q.isSelect(); // is false
while (q.next()) { // is never true
qDebug() << q.value(0).toByteArray()
}
edit:
I am running Qt 4.5.3 on OpenSuse 11.2