Page 1 of 1

SQLIte3?

Posted: Tue Aug 15 2023 7:09 pm
by wogsterca
Something I am doing isn't working Running Copperspice 1.8.2 with the latest patches, I think... OS is Fedora 38, Compiler GCC

have the following code :

QSqlDatabase dbms;
dbms.addDatabase("QSQLITE");
dbms.setDatabaseName(s_dbms);
if(!dbms.open())
{
qDebug() << dbms.lastError().text();
return(-1);
}

I get Driver not loaded

What am I missing???? The driver is supposed to be built in, isn't it????

Re: SQLIte3?

Posted: Thu Aug 17 2023 1:45 am
by barbara
The method addDatabase() is static and the result must be assigned to your QSqlDatabase variable. Please give the following code a try.

Code: Select all

QSqlDatabase dbms;
dbms = QSqlDatabase::addDatabase("QSQLITE");
dbms.setDatabaseName(s_dbms);

if (! dbms.open()) {
   qDebug() << dbms.lastError().text();
   return(-1);
}
Barbara

Re: SQLIte3?

Posted: Thu Aug 17 2023 5:15 pm
by wogsterca
Thanks, that worked.....