[solved] manage sqlite database
-
wrote on 18 Aug 2011, 13:47 last edited by
I guess I'll use the one Rahul suggested. Thanks to the both of you.
-
wrote on 18 Aug 2011, 20:01 last edited by
I found sqlitebrowser a little bit buggy sometimes.
Other tools you can use are "Sqliteadmin":http://sqliteadmin.orbmu2k.de/ or "Sqliteman":http://sqliteman.com/
-
wrote on 19 Aug 2011, 06:27 last edited by
The problem is, I don't know where my game saves the database file so I can open it.
-
wrote on 19 Aug 2011, 07:05 last edited by
Unfortunately, we won't be able to solve the problem for you :). Try to perform a research on some folders, you might be lucky and find your base. On windows, you could maybe try looking at %AppData% folder.
-
wrote on 19 Aug 2011, 07:25 last edited by
I've been searching the file before. I just wanna know what file extension does the database have.
-
wrote on 19 Aug 2011, 10:45 last edited by
@db.setDatabaseName(":memory:");@
If you gave database name like above, db file would reside in the memory.@db.setDatabaseName("your_db_name");@
But , in this case,db will be created in the same folder where the executable is residing. -
wrote on 19 Aug 2011, 10:48 last edited by
Assuming, you are using QtCreator with "default" build settings (projectname_build_simulator), Db file can be found here,if you have given like
@db.setDatabaseName("your_db_name");@ -
wrote on 19 Aug 2011, 10:50 last edited by
[quote author="nhojyer07" date="1313738720"]I've been searching the file before. I just wanna know what file extension does the database have.[/quote]
I guess you dont need to worry about this. There is no typical extension, other than the file name, unless you give one.
-
wrote on 19 Aug 2011, 11:25 last edited by
Rahul, please stop replying to yourself. Just add to your previous message if you want to add more contents.
-
wrote on 19 Aug 2011, 11:28 last edited by
Adre, i am sorry. I just wanted it to be separate and clear. Will do,next time.
-
wrote on 19 Aug 2011, 16:51 last edited by
Thanks for the reply Rahul. You've been a great help.
EDIT: I tried using setDatabaseName() as you suggested though I just receive an error.
Result of expression 'db.setDatabaseName' [undefined] is not a function.
Using the "SQL Local Storage example":http://doc.qt.nokia.com/4.7-snapshot/declarative-sqllocalstorage.html as reference, where should I call the function?
-
wrote on 19 Aug 2011, 19:33 last edited by
I am not really familiar with QML though, i suppose , you can still follow how we connect in a normal Qt application. :) ie,for example, in your main,
@int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("db_name");@Am sorry, :( dont know much about QtQuick :(
And don't forget to add sql module in *.pro file.
-
wrote on 20 Aug 2011, 03:38 last edited by
So the reason why I can't find the database is its filename is composed of a combination of hexadecimal numbers. I finally found it at last. Thank you very much for the help guys. I guess this is completely solved.
14/17