SQLIte3?

Post Reply
wogsterca
Posts: 5
Joined: Thu Aug 10 2023 3:26 pm

SQLIte3?

Post 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????
barbara
Posts: 454
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: SQLIte3?

Post 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
wogsterca
Posts: 5
Joined: Thu Aug 10 2023 3:26 pm

Re: SQLIte3?

Post by wogsterca »

Thanks, that worked.....
Post Reply