#include #include #include #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); QString dbConnectionName = "dbConnection"; QSqlDatabase db = QSqlDatabase::addDatabase("QIBASE", dbConnectionName ); db.setHostName("localhost"); db.setDatabaseName("c:\\DoesNotExist.fdb"); db.setUserName("sysdba"); db.setPassword("masterkey"); // First open does not work if( !db.open() ) { QMessageBox::warning(0, "Open database failed - 1", db.lastError().text(), QMessageBox::Ok); } db.setDatabaseName("c:\\database.fdb"); if( !db.open() ) { QMessageBox::warning(0, "Open database failed - 2", db.lastError().text(), QMessageBox::Ok); } // At this point I expect the driver to have cleared its isOpenError.... QSqlQuery qry(db); // But exec fails, because the the driver hasn't cleared it. if( !qry.exec("SELECT RDB$RELATION_NAME FROM RDB$RELATIONS") ) { QMessageBox::warning(0, "query failed", qry.lastError().text(), QMessageBox::Ok); } return 0; }