Results 1 to 3 of 3

Thread: QtSql: execBatch() with SELECT statements

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtSql: execBatch() with SELECT statements

    Why don't you build a list of the ids you want to retrieve. (I assume, that its not just all or some simple subset...)

    Qt Code:
    1. QString idset = "(";
    2. for (int i=0;i < list.length();++i)
    3. {
    4. idset += QString::number(list.at(i));
    5. if (i < list.length()-1)
    6. idset += ",";
    7. }
    8. idset += ")";
    9.  
    10. q.exec("SELECT my_blob_column FROM my_table WHERE id in "+idset+";");
    11. while (q.next())
    12. {
    13. }
    14. ..
    To copy to clipboard, switch view to plain text mode 

    HIH

    Johannes

  2. #2
    Join Date
    Jan 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QtSql: execBatch() with SELECT statements

    Thank you Johannes,
    I have tried using execBatch() so much that I did not see the obvious workaround :-)
    Tobias

Similar Threads

  1. about Windows Ado and QtSql
    By lutins in forum General Programming
    Replies: 1
    Last Post: 1st September 2008, 20:04
  2. problem of QtSql
    By cresthong in forum Qt Programming
    Replies: 1
    Last Post: 17th July 2008, 17:48
  3. a problem about QSqlQuery::execBatch()
    By yjyong1217 in forum Qt Programming
    Replies: 0
    Last Post: 29th January 2008, 03:28
  4. QtSql and Windows Vista
    By imitrik in forum Qt Programming
    Replies: 1
    Last Post: 5th October 2007, 19:19
  5. reading fprintf statements from console in qt
    By KrishnaKishan in forum Qt Programming
    Replies: 2
    Last Post: 15th March 2007, 10:00

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.