August 12, 2011

nhojyer07 nhojyer07
Lab Rat
28 posts

[solved] manage sqlite database

Page  
1

Hi! I just wanna ask if there’s something like a SQLite manager included in the SDK? If not, can someone point me to one? Thanks!

16 replies

August 12, 2011

Eddy Eddy
Area 51 Engineer
1295 posts

No Qt has no sqlite manager, but if you google you will find a lot of them, even cross platform ones. Here is a link [sqlite.com] with lot’s of details. If you let us know what you consider important and what OS you want it for, then maybe we could share what we experienced with one of them.

http://sqlite.com/cvstrac/wiki?p=ManagementTools

 Signature 

Qt Certified Specialist
Qt Ambassador

August 17, 2011

nhojyer07 nhojyer07
Lab Rat
28 posts

I just want to see what’s going on with the database created by the mobile game I am working on. I want to edit some records in the database for testing on the simulator.

August 17, 2011

Rahul Das Rahul Das
Robot Herder
354 posts

Are you looking for a database browser like this [sqlitebrowser.sourceforge.net]

 Signature 

——————————-

    Rahul Das

——————————-

August 18, 2011

nhojyer07 nhojyer07
Lab Rat
28 posts

I guess I’ll use the one Rahul suggested. Thanks to the both of you.

August 18, 2011

octal octal
Lab Rat
74 posts

I found sqlitebrowser a little bit buggy sometimes.

Other tools you can use are Sqliteadmin [sqliteadmin.orbmu2k.de] or Sqliteman [sqliteman.com]

August 19, 2011

nhojyer07 nhojyer07
Lab Rat
28 posts

The problem is, I don’t know where my game saves the database file so I can open it.

August 19, 2011

octal octal
Lab Rat
74 posts

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.

August 19, 2011

nhojyer07 nhojyer07
Lab Rat
28 posts

I’ve been searching the file before. I just wanna know what file extension does the database have.

August 19, 2011

Rahul Das Rahul Das
Robot Herder
354 posts

  1. db.setDatabaseName(":memory:");

If you gave database name like above, db file would reside in the memory.

  1. db.setDatabaseName("your_db_name");

But , in this case,db will be created in the same folder where the executable is residing.

 Signature 

——————————-

    Rahul Das

——————————-

August 19, 2011

Rahul Das Rahul Das
Robot Herder
354 posts

Assuming, you are using QtCreator with “default” build settings (projectname_build_simulator), Db file can be found here,if you have given like

  1. db.setDatabaseName("your_db_name");

 Signature 

——————————-

    Rahul Das

——————————-

August 19, 2011

Rahul Das Rahul Das
Robot Herder
354 posts
nhojyer07 wrote:
I’ve been searching the file before. I just wanna know what file extension does the database have.

I guess you dont need to worry about this. There is no typical extension, other than the file name, unless you give one.

 Signature 

——————————-

    Rahul Das

——————————-

August 19, 2011

Andre Andre
Area 51 Engineer
6031 posts

Rahul, please stop replying to yourself. Just add to your previous message if you want to add more contents.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

August 19, 2011

Rahul Das Rahul Das
Robot Herder
354 posts

Adre, i am sorry. I just wanted it to be separate and clear. Will do,next time.

 Signature 

——————————-

    Rahul Das

——————————-

August 19, 2011

nhojyer07 nhojyer07
Lab Rat
28 posts

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 [doc.qt.nokia.com] as reference, where should I call the function?

August 19, 2011

Rahul Das Rahul Das
Robot Herder
354 posts

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,

  1. int main(int argc, char *argv[])
  2. {
  3.   QApplication app(argc, argv);
  4.   QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
  5.   db.setDatabaseName("db_name");

Am sorry, :( dont know much about QtQuick :(

And don’t forget to add sql module in *.pro file.

 Signature 

——————————-

    Rahul Das

——————————-

Page  
1

  ‹‹ Using Subdirs      Crash Handler for Qt ››

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