October 16, 2010

hungchuviet hungchuviet
Lab Rat
37 posts

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!

7 replies

October 16, 2010

Alexander Kuchumov Alexander Kuchumov
Lab Rat
377 posts

Try this in the .pro file:

  1. sqfiles.sources = file with sqlite
  2. DEPLOYMENT += sqfiles

October 16, 2010

kalle kalle
Lab Rat
42 posts

An SQLite database is just one single file that needs to be installed on the device. If you are using QMake, use the DEPLOYMENT variable to do that.

October 16, 2010

kalle kalle
Lab Rat
42 posts

Alexander beat me there while I was typing :-)

October 19, 2010

Alexander Kuchumov Alexander Kuchumov
Lab Rat
377 posts

kalle :)

June 8, 2012

remy_david remy_david
Lab Rat
24 posts

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

  1. sqldeployment.sources = db.sqlite
  2. sqldeployment.path = .
  3. DEPLOYMENT += sqldeployment

.cpp

  1. QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
  2. 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 ?

June 8, 2012

remy_david remy_david
Lab Rat
24 posts

Ok I found a solution :

  1. QString apppath = QApplication::applicationDirPath();
  2. QString dbpath(apppath);
  3. dbpath.append(QDir::separator()).append("db.sqlite");
  4. dbpath = QDir::toNativeSeparators(dbpath);
  5. 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.

June 11, 2012

francomartins francomartins
Hobby Entomologist
61 posts

  1. QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
  2. db.setDatabaseName(qApp->applicationDirPath()+"/"db.sqlite");

for windows users use on main.cpp for define a librarypath :

  1. #ifdef Q_OS_WIN32
  2.     QString env = getenv("SYSTEMROOT");
  3.     QCoreApplication::addLibraryPath(env+"\\system32");
  4. #endif

 
  ‹‹ Lack of Symbian kinetic scrolling is a major usability issue      Can I write code for windows mobile 6.5 and how? ››

You must log in to post a reply. Not a member yet? Register here!