×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    4

    Updating a SQLite db on Nokia N8

    Hi all,
    I've written an app for the Nokia N8 that uses a SQLite db for data storage. Querying the db is fine, and all necessary data is read and returned. Updating the db however causes problems in that UPDATE statements aren't being committed when the app is being run on the device. It works fine on the simulator, and fine while the app is running i.e. edited values are reflected in the app's UI. However, when I exit the app on the device and then re-open it, the supposedly updated values are no longer there as though changes made to the db haven't been committed / saved whereas on the simulator they are. What do I need to do in order to have updated values in the db saved when the app is exited?

    Regards

    Angus

  2. #2
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: Updating a SQLite db on Nokia N8

    Hi,

    After the UPDATE statements are you also explicilty using the commit api for the db. This should be done explicitly.

    For e.g. if you are using qsql apis, for opening database and performing update and other operations, you need to call db.commit() after the operations. Also check if the database connection is properly closed.

    http://doc.qt.nokia.com/4.7-snapshot...se.html#commit

    Please drop a small piece of code that you are using if the above doesnot help to help you more.

  3. #3
    Registered User
    Join Date
    Dec 2011
    Posts
    4

    Re: Updating a SQLite db on Nokia N8

    Thanks for the reply Kusumk,
    here's a code snippet :

    QSqlQuery query(db);
    query.prepare("UPDATE ZATTRACTION SET ZFAVOURITE = 1 WHERE ZPROPERTYID = ?");
    query.addBindValue(pid);
    query.exec();
    query.finish();
    db.commit();

    How can I destroy the (main) object that holds the QSqlQuery and QSqlDatabase objects on exiting from the application?

  4. #4
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: Updating a SQLite db on Nokia N8

    Hi,

    Are your transactions/updations committed on to the db in device after using explicit commit()?

    Since you have statically allocated and not used any pointers, i dont think you need to explicitly free any objects, they are allocated in stack and would be destroyed when you exit the application. Incase you have any other memory allocations done for the rest of the members of the main object, you can take care of deleting them in the destructor of that class.

    Correct me if am wrong as i havenot tested this.

Similar Threads

  1. Sqlite with Nokia Qt SDK
    By remy_david in forum [Archived] Qt SDKs and Tools
    Replies: 15
    Last Post: 2011-02-23, 11:27
  2. SQLite Support in Nokia devices
    By gsarmentero in forum Mobile Java General
    Replies: 2
    Last Post: 2010-09-07, 20:48
  3. Replies: 1
    Last Post: 2009-06-06, 14:29
  4. [moved] Nokia Firmware Updating Error
    By leonardo_keanu in forum General Development Questions
    Replies: 1
    Last Post: 2008-08-14, 10:20
  5. Nokia 3320 software updating
    By moredhel in forum General Development Questions
    Replies: 0
    Last Post: 2003-07-31, 13:50

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×