Results 1 to 9 of 9

Thread: Does QDataWidgetMapper lock sqlite and prevent write by other applications?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2009
    Posts
    47
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: QSqlTableModel locks sqlite and prevents write by other applications

    Hi all

    I found a work-around: prefetch the entire table. Obviously, this is only feasible for small database tables (small compared to available memory).

    Add the following statement after select()'ing the model (i.e., after line 42 in my example)
    Qt Code:
    1. while (model->canFetchMore()) model->fetchMore();
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QSqlTableModel locks sqlite and prevents write by other applications

    Another option would be to implement your own QAbstractTableModel subclass and use QSqlQuery internally.

    Since you know which database you are using, this model might even use database specific features, e.g. paging.

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 25th April 2013, 14:55
  2. Replies: 2
    Last Post: 14th November 2011, 11:24
  3. sqlite read lock.
    By gilgm in forum Qt Programming
    Replies: 6
    Last Post: 18th June 2010, 05:58
  4. sqlite write security
    By lesat in forum Qt Programming
    Replies: 0
    Last Post: 28th April 2010, 05:05
  5. SQLite + journal + lock
    By NoRulez in forum Qt Programming
    Replies: 4
    Last Post: 14th December 2009, 08:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.