Quantcast
Channel: Qt DevNet forums: Installation and Deployment
Viewing all articles
Browse latest Browse all 2113

how to use same db (SqLite) on all platforms?

$
0
0
HI, I’m using a SqLite database and with full path to it is working ok on windows – but not on linux and not on android. const QString dbType("QSQLITE");  if(!QSqlDatabase::isDriverAvailable(dbType)){   qCritical() <<dbType << " database module not available.";   return false;  }  QString dbfile_path = QApplication::applicationDirPath() + "/db/test.db"; QSqlDatabase mydb = QSqlDatabase::addDatabase(dbType);  mydb.setDatabaseName(dbfile_path); mydb.open() and so on… now if I will use as QString dbfile_path = "c:/myproject/test/db/test.db"; it will work on windows but not on linux or android how can I do it to work on windows and on android and linux? also i see it does not copy the test.db who is in the db folder to the c:/myproject/build-test-Desktop_Qt_5_2_1_MinGW_32bit-Debug/debug/db – where is the place that to be if I will add this qDebug() << dbfile_path; this is the output c:/myproject/build-test-Desktop_Qt_5_2_1_MinGW_32bit-Debug/debug/db/test.db but it does not copy the file there so this path does not exist instead the file is located at c:/myproject/test/db/test.db please help me with this.. thanks Andrew

Viewing all articles
Browse latest Browse all 2113

Trending Articles