jeudi 30 avril 2015

DELETE FROM table fails in QtSql but not in sqlite3 cli

The following fails:

QSqlQuery query;
if (query.exec("DELETE FROM files")){
    qCritical() << query.lastError().driverText();
    qCritical() << query.lastError().databaseText();
    qCritical() << query.lastError().isValid();
    qCritical() << query.lastError().nativeErrorCode();
    qCritical() << query.lastError().text();
    qCritical() << query.lastError().type();
    qFatal(SQLERR);
}

Outputs

Critical: ""  --  [void Files::FileIndex::reset()]
Critical: ""  --  [void Files::FileIndex::reset()]
Critical: false  --  [void Files::FileIndex::reset()]
Critical: ""  --  [void Files::FileIndex::reset()]
Critical: " "  --  [void Files::FileIndex::reset()]
Critical: 0  --  [void Files::FileIndex::reset()]

Funny because 0 is QSqlError::NoError 0 No error occurred. The database exists the error message is empty... any help. In the cli this works well.

Aucun commentaire:

Enregistrer un commentaire