Results 1 to 3 of 3

Thread: QSqlQuery Exec and QProgressBar Update

  1. #1
    Join Date
    Jan 2013
    Posts
    11
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QSqlQuery Exec and QProgressBar Update

    Hello,

    I am uploading/downloading BLOB files into a MySQL Database and it works well with small files. However BLOB sizes in MySQL can go upwards to 2GB per entry in a database, and i want to allow my application to upload up to that limit. At the moment when i upload a small file, using a QSqlQuery.bindValue and QSqlQuery.prepare, it works. But when i try to upload a larger file, it hangs until its done.

    Now i can separate it so it doesn't hang using a QObject.movetoThread() and doing my work in that thread, but what I'm really looking for is a way to bind a signal/slot from the QSqlQuery.exec() to a ProgressDialog.setValue() .

    Do i have to subclass a QSqlQuery and rewrite something there, or is there another way?

    I want to show the user, something is either being uploaded, or downloaded with a progress bar, and also put a cancel button there if they want to stop it.

    I know if this was a QIODevice, i could use bytesWritten for such progress display, is there anything similar for QSqlQuery and Exec?

    Thank you.

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlQuery Exec and QProgressBar Update

    I don't think that MySQL driver can do this so QSqlQuery also can not.

  3. #3
    Join Date
    Jan 2013
    Posts
    11
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSqlQuery Exec and QProgressBar Update

    Hello, Thank you for your reply. That would make sense if the driver didn't have that capability. :-(

    Ok in that case, if the Driver doesn't allow it.. I don't know how to rewrite a driver... But, MYSQL you can CONCAT which is a way to Append the data, so im going to try splitting a file first, and appending it and updating the QProgressDialog as i go. This way might be sufficient.

    The idea is to split a 100MB file into 1MB bits, and after each upload, report back and update the QProgressDialog. At least this way we will see some form of Progress Downloading and Uploading.

    Any thoughts?

    Thank you.

    Edit: After reading this maybe it is not such a good idea to keep appending to a blob in such a way. Might have to just have a permanent Progress bar in IDLE State to indicate some action is taking place, and alert the user, larger files will take time to send!

    If anyone else has any thoughts, please let me know.

    Thank you.
    Last edited by zerokewl; 7th September 2013 at 14:39.

Similar Threads

  1. Abort QSqlQuery::exec()
    By elmo in forum Qt Programming
    Replies: 5
    Last Post: 13th October 2013, 20:50
  2. QSqlQuery exec blocking function
    By reinki0013 in forum Qt Programming
    Replies: 5
    Last Post: 13th August 2012, 18:00
  3. Replies: 1
    Last Post: 18th July 2011, 12:12
  4. QSqlQuery.exec() weird error
    By MarkoSan in forum Qt Programming
    Replies: 3
    Last Post: 25th May 2010, 13:02
  5. QSqlQuery and no response while exec()
    By jacek_ in forum Qt Programming
    Replies: 5
    Last Post: 5th November 2009, 08:47

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.