How do I deploy an existing sqlite database with my qt application on Symbian device?
-
I have one SQLite database, I want to deploy it with my App on symbina device.
But I don't know how to do?
Help me! -
Hello,
This solution works as long as you deploy to C:\ drive on Symbian.
But when deploying on E:\ (aka mass storage), this won't work :.pro
@sqldeployment.sources = db.sqlite
sqldeployment.path = .
DEPLOYMENT += sqldeployment@.cpp
@QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("db.sqlite");@The file db.sqlite exists in E:\Private\appID\ folder but do not get loaded by QSqlDatabase
With C:\Private\appID\ it works fine.Any clue ?
-
Ok I found a solution :
@
QString apppath = QApplication::applicationDirPath();
QString dbpath(apppath);
dbpath.append(QDir::separator()).append("db.sqlite");
dbpath = QDir::toNativeSeparators(dbpath);
db.setDatabaseName(dbpath);
@This way it works both with C:\ and E:\ deployment.
I can't see why the other way did not work however. -
@
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(qApp->applicationDirPath()+"/"db.sqlite");
@for windows users use on main.cpp for define a librarypath :
@
#ifdef Q_OS_WIN32
QString env = getenv("SYSTEMROOT");
QCoreApplication::addLibraryPath(env+"\system32");
#endif
@