c++ - Check if QSqlQuery::addBindValue() has failed -


how can check if qsqlquery::addbindvalue() has failed? example, there might not more placeholders left bound. consider code:

qsqlquery q; q.prepare("insert table1 (field1) values (?)"); q.addbindvalue("value1"); q.addbindvalue("value2"); // 1 should fail 

however, addbindvalue() void, doesn't return information whether succeeded or failed.

i stepped sources, , seems can't find out if has failed. doesn't set last error or other error code:

void qsqlresult::bindvalue(int index, const qvariant& val, qsql::paramtype paramtype) {     q_d(qsqlresult);     d->binds = positionalbinding;     qlist<int>& indexes = d->indexes[d->fieldserial(index)];     if (!indexes.contains(index))         indexes.append(index);     if (d->values.count() <= index)         d->values.resize(index + 1);     d->values[index] = val;     if (paramtype != qsql::in || !d->types.isempty())         d->types[index] = paramtype; } 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -