Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [solved] manage sqlite database
Forum Updated to NodeBB v4.3 + New Features

[solved] manage sqlite database

Scheduled Pinned Locked Moved Qt Creator and other tools
17 Posts 5 Posters 6.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nhojyer07
    wrote on last edited by
    #7

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

    1 Reply Last reply
    0
    • O Offline
      O Offline
      octal
      wrote on last edited by
      #8

      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.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nhojyer07
        wrote on last edited by
        #9

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

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rahul Das
          wrote on last edited by
          #10

          @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.


          Declaration of (Platform) independence.

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rahul Das
            wrote on last edited by
            #11

            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");@


            Declaration of (Platform) independence.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Rahul Das
              wrote on last edited by
              #12

              [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.


              Declaration of (Platform) independence.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #13

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

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  Rahul Das
                  wrote on last edited by
                  #14

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


                  Declaration of (Platform) independence.

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    nhojyer07
                    wrote on last edited by
                    #15

                    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?

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      Rahul Das
                      wrote on last edited by
                      #16

                      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.


                      Declaration of (Platform) independence.

                      1 Reply Last reply
                      0
                      • N Offline
                        N Offline
                        nhojyer07
                        wrote on last edited by
                        #17

                        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.

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved