How to add sqlite to QResource
-
I added an sqlite to qresource. When I used db.setDataBaseName(":/new/logindb.sqlite");
When I did that it didn't work.
Or is there any other way that I make the database to work on any PC because am using its path on my system which will not work on other systems. -
I added an sqlite to qresource. When I used db.setDataBaseName(":/new/logindb.sqlite");
When I did that it didn't work.
Or is there any other way that I make the database to work on any PC because am using its path on my system which will not work on other systems.@gblessed your resource system is in the best case readonly. So simply opening your database from there won't work.
I suggest on startup copying the db file to the local drive, if it doesn't exist.
QStandardPaths is the class you should check out to identify read/writeable path of your system
-
@gblessed your resource system is in the best case readonly. So simply opening your database from there won't work.
I suggest on startup copying the db file to the local drive, if it doesn't exist.
QStandardPaths is the class you should check out to identify read/writeable path of your system
-
@gblessed please be aware that any changes (updates/deletions) you do to the DB will be overwritten (lost!) next time you extract the DB from QResource into filesystem... be careful