Pong
June 18th 2014, QSqlDatabase
← June 18th 2014 SQLite | ● | June 20th 2014 SQLite CLI →
Qt contains a wrapper for SQLite. A SQLite database is created by opening a connection to the SQLite driver.
QSqlDatabase db;
// open default connection with SQLite driver
db = QSqlDatabase::addDatabase("QSQLITE");
// determine db path
QString path(QDir::home().path());
path.append(QDir::separator()).append("db.sqlite");
path = QDir::toNativeSeparators(path);
db.setDatabaseName(path);
// open db
db.open();
// open default connection with SQLite driver
db = QSqlDatabase::addDatabase("QSQLITE");
// determine db path
QString path(QDir::home().path());
path.append(QDir::separator()).append("db.sqlite");
path = QDir::toNativeSeparators(path);
db.setDatabaseName(path);
// open db
db.open();