[Qt-interest] QSqlDatabase with Sqlite question
Jason H
scorp1us at yahoo.com
Fri Nov 20 00:46:22 CET 2009
Note the emphasised {{{{{{{{{{{{{{{{{ }}}}}}}}}}}}}}}}}}}}}}s
----- Original Message ----
From: KC Jones <kc at asperasoft.com>
To: Jason H <scorp1us at yahoo.com>
Cc: Duane Hebert <spoo at flarn.com>; qt-interest at trolltech.com
Sent: Thu, November 19, 2009 2:43:17 PM
Subject: Re: [Qt-interest] QSqlDatabase with Sqlite question
Thanks for all the advice. Somehow, I'm still not arriving at a
solution. (BTW: Providing an explicit name for the connection only
seemed to make matters worse.) But following Jason's advice as I
understood it, I now have this code, still plagued by the same warning
message:
#include <QtCore>
#include <QtSql>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QFile::remove("./test.db");
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{QSqlDatabase connection = QSqlDatabase::addDatabase("QSQLITE");
connection.setDatabaseName("./test.db");
if (connection.open())
{
QSqlQuery* q = new QSqlQuery();
q->exec("CREATE TABLE foo2 ( id integer PRIMARY KEY, bar integer );");
delete q;
connection.close();
}
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
QSqlDatabase::removeDatabase(connection.connectionName());
return a.exec();
}
More information about the Qt-interest-old
mailing list