Results 1 to 3 of 3

Thread: Threaded QSql + QT MVC mechanism

  1. #1
    Join Date
    Jul 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Threaded QSql + QT MVC mechanism

    Hello,

    I have small problem regarding QT's MVC mechanism.

    I managed to create some code that allows me to use threaded MySQL queries with QT (database engine class + threaded worker class exchanging lists of QSqlResult objects). This works fine for me.

    But know I'm looking for best way of connecting threaded sql with QT's MVC mechanism (for example with QSqlRelationalTableModel class).

    I'm currently working with application using SQL in single thread with relational table model (MVC way), but database has grown larger and this way is no longer acceptable.

    I have few classes that are derived from QSqlRelationalTableModel and I'm using in application. I suppose it is the place I should start reimplementation - maybe something like - QSqlRelationalTableModel using QSqlResult list from my threaded database engine. This mean - db engine <-(QList<QSqlResult>)-> db worker, and QSqlTableModel reimplementation. Is that correct method ?

    Maybe some one has done it before ?

    I was looking for some hint all over the internet for months - so far no luck.

    Thanks in advance for help & hints !

    Best Regards,
    Grzesiek

  2. #2
    Join Date
    Aug 2008
    Posts
    70
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Threaded QSql + QT MVC mechanism

    Hi,

    Take care, as you can see here: http://doc.qt.nokia.com/4.7-snapshot/threads-modules.html
    "A connection can only be used from within the thread that created it. Moving connections between threads or creating queries from a different thread is not supported."

  3. #3
    Join Date
    Jul 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Threaded QSql + QT MVC mechanism

    Quote Originally Posted by miraks View Post
    Take care, as you can see here: http://doc.qt.nokia.com/4.7-snapshot/threads-modules.html
    "A connection can only be used from within the thread that created it. Moving connections between threads or creating queries from a different thread is not supported."
    Yes, that is right, but who said I'm moving SQL connection between threads ?

    I'm creating and using SQL connection in separate thread and only moving QList<QSqlResult> between threads - and that is OK and is WORKING. There is no limitation in moving QSqlResult objects between threads.

    The thing is - how to integrate this with QT's MVC mechanism.

    Regards,
    Grzesiek

Similar Threads

  1. signal -slot mechanism
    By qt_user in forum Qt Programming
    Replies: 2
    Last Post: 30th July 2010, 19:34
  2. exception mechanism
    By guchangyuan in forum Qt Programming
    Replies: 2
    Last Post: 10th August 2009, 05:57
  3. The threaded signal/slot mechanism
    By xbtl in forum Newbie
    Replies: 1
    Last Post: 30th March 2008, 01:07
  4. Magic of Virtual Mechanism in C++
    By joseph in forum General Programming
    Replies: 2
    Last Post: 21st January 2008, 14:22
  5. Can we have IPC mechanism ?
    By vijay anandh in forum Qt Programming
    Replies: 3
    Last Post: 3rd May 2006, 20:26

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.