Results 1 to 5 of 5

Thread: using sqlite3_busy_timeout() in Qt

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Posts
    23
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default using sqlite3_busy_timeout() in Qt

    I set database:
    Qt Code:
    1. QsqlDatabase db;
    2. db = QsqlDatabase::addDatabase("QSQLITE");
    To copy to clipboard, switch view to plain text mode 

    But I can not find how can I use sqlite3_busy_timeout(sqlite3*, int ms) function in Qt.

  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: using sqlite3_busy_timeout() in Qt


  3. #3
    Join Date
    Mar 2011
    Posts
    23
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: using sqlite3_busy_timeout() in Qt

    @anda_skoa thank you for your answer but I do not undestand how can I use the function?
    handle () gives me sqlite3 object but how can I use the sqlite3_busy_timeout() function?
    can you give an example?

  4. #4
    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: using sqlite3_busy_timeout() in Qt

    Not sure what you need an example for, the function seems to be quite simple to call
    Qt Code:
    1. QVariant v = db.driver()->handle();
    2. if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0) {
    3. // v.data() returns a pointer to the handle
    4. sqlite3 *handle = *static_cast<sqlite3 **>(v.data());
    5. if (handle != 0) { // check that it is not NULL
    6.  
    7. sqlite3_busy_timeout(handle, 100);
    8.  
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  5. #5
    Join Date
    Mar 2011
    Posts
    23
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: using sqlite3_busy_timeout() in Qt

    @anda_skoa I get it. thank you .

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.