Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [SOLVED] How to write in a database on N950?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] How to write in a database on N950?

Scheduled Pinned Locked Moved Mobile and Embedded
13 Posts 4 Posters 5.4k 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.
  • M Offline
    M Offline
    mismail
    wrote on last edited by
    #3

    Sorry for spilling mistake , here is the error i got

    bq. Bus error (core dumped)

    I am just trying to open the Db file on meego OS, however the code is working fine on symbian.
    I just changed the paths of the DB.

    //myApplication.PRO

    @
    symbian{
    dbFiles.sources += faces.db
    dbFiles.path = ./data/
    DEPLOYMENT += dbFiles
    }
    unix:!symbian{
    db.files = faces.db
    db.path = /opt/myApplication/data
    INSTALLS += db
    }@

    //dbConnector.cpp
    @#ifdef Q_OS_SYMBIAN
    iDB = new QSqlDatabase(QSqlDatabase::addDatabase("QSQLITE"));
    QString path = QDir::currentPath();
    path.append("/data/faces.db");
    #else
    QString path("/opt/myApplication/data/faces.db");
    #endif@

    Thank you for your help

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

      Do you really mean to have the creation of the database object only for symbian?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mismail
        wrote on last edited by
        #5

        Ohhhhh sorry it is a big mistake, really i didn't notice that.
        Thank you very much.

        but I got another error i think this time it is a real error, when i try to write or read from the DB file I always get the following message.
        bq. "attempt to write a readonly database Unable to fetch row"

        the database exists in the following path

        "/opt/myapplication/data/faces.db"

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

          You don't seem to have rights to modify the database in question.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mismail
            wrote on last edited by
            #7

            yes, I think it a problem of permission, So should i change it's path or there is a way to change the Db permission pragmatically.
            I saw the db file permission and it was (-rw-r--r--) I think that the only one who has the permission to write the file is the root.
            How can I deal with that?
            Thanks in advance

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mismail
              wrote on last edited by
              #8

              When I tried to run the application as root the application was successfully able to read and write the DB file.
              SO how can I change the permission of the Db for the User?

              1 Reply Last reply
              0
              • G Offline
                G Offline
                geronik
                wrote on last edited by
                #9

                Hi,
                I had similar problems and they are caused by the deployment setting permissions to read only. So this is what I did to solve this.

                • Created a post installation script named ex. myapp.postinst.
                • Inside that script copied the file I would like to use ex. @cp /opt/myapp/path/to/file.txt /opt/myapp/path/to/copy.txt@ and also @chmod a+rwx /opt/myapp/path/to/copy.txt@ to change permissions..
                • Created a pre removal script named doing removing stuff
                • The application must of course use the copied file created from the post installation script.
                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mismail
                  wrote on last edited by
                  #10

                  how could you add this post script to the package?

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    geronik
                    wrote on last edited by
                    #11

                    You could do that from inside QtCreator also, you should already have added the packaging files for Debian Harmattan device. Then just right click to the root item named qt_packaging/Debian_Harmattan and in the wizzard select the choice 'text file' and supply a name for that file. Then rename the new file to "myapp.postinst", add your code and that's it .

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mismail
                      wrote on last edited by
                      #12

                      I did that but i didn't copy the db file i just changed it's permission and it's parent folder
                      chmod a+w /home/user/.myapplication/data
                      chmod a+w /home/user/.myapplication/data

                      Thank you

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        geronik
                        wrote on last edited by
                        #13

                        Could that also.. :-)

                        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