Independently of the parameter that I set to the setDatabaseName
function, the open
function always returns true. Is that normal?
For example:
If I ran the following code:
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("");
if( db.open() )
{
qDebug() << "open";
}
The open function returns true.
What I expect is that the open function only returns true if it was successfully connected to the database.
I already find some topics but none solved my problem:
Qt 5.5 QSqlDatabase::open() always returns true?
QSqlDatabase::open() always returns true
QSqlDatabase open always returns true after update
I am using SQLite and Qt 5.3.2.