Results 1 to 2 of 2

Thread: Best way to abort long SQL query?

  1. #1
    Join Date
    Mar 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Best way to abort long SQL query?

    What is the best method for aborting an overly-long SQL query?

    I've got a Qt4.3.3 app that queries a MySQL database via QSqlQuery::exec() & steps through the QSqlQuery::value() results while QSqlQuery::next() is true. I plan to display a "Be patient" dialog to the user via a QTimer if QSqlQuery::next() hasn't begun returning within a certain time but I'd also like to provide the user with a "Query Abort" if needed.

    For my Qt app I am guessing it's as simple as ignoring the returned result set (breaking out of the QsqlQuery::next() loop), right? Any consequences to this (like "unconsumed data" polluting result sets of future queries?

    Also, I know mysqladmin can abort a query and command the db engine to cease expending resources executing it but I don't see access to this capability through Qt. Any suggestions?


    Very sorry if these are overly-naive questions but this is an area in which I've had little experience.

    Thanks for the guidance,
    Bill

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Best way to abort long SQL query?

    Quote Originally Posted by wdezell View Post
    Also, I know mysqladmin can abort a query and command the db engine to cease expending resources executing it
    As far as I understand it it needs a separate db connection to do that.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. SQL query - navigation buttons
    By apffal in forum Qt Programming
    Replies: 1
    Last Post: 5th August 2009, 09:38
  2. MS SQL Query
    By baray98 in forum General Programming
    Replies: 0
    Last Post: 14th July 2009, 05:25
  3. how to abort a function taking to long to process
    By john_god in forum General Programming
    Replies: 5
    Last Post: 30th April 2009, 02:06
  4. QTableWidget Sql Query 25.000 records
    By aekilic in forum Qt Programming
    Replies: 2
    Last Post: 12th August 2008, 15:54
  5. Sql Query Problem
    By MrShahi in forum Qt Programming
    Replies: 6
    Last Post: 30th May 2008, 10:16

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.