Results 1 to 3 of 3

Thread: Qt4 Mysql stored procedure

  1. #1
    Join Date
    Apr 2010
    Posts
    21
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Qt4 Mysql stored procedure

    I am trying to call a Mysq 5 stored procedure from a Qt4 application.
    I am doing something like the following:

    QSqlQuery query2 = QSqlQuery();
    bool queryStatus = query2.exec("CALL toto()");
    int numRows = query2.size();

    I get queryStatus set to true, but the number of rows is completly wrong (4294967295) and query2.isSelect() returns false.

    Calling a simple request works perfectly.

    I have spent several hours, any help is more than welcome.

    Lynn

  2. #2
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Qt4 Mysql stored procedure

    I created a stored procedure with a "select/where" statement and your code works fine here.

    Does "call toto()" work from the command line of your MySQL shell?

  3. #3
    Join Date
    Apr 2010
    Posts
    21
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Qt4 Mysql stored procedure

    >>Does "call toto()" work from the command line of your MySQL shell?
    Yes it does.

    As my program is currently a test, I have before the stored procedure test another database connexion test (a simple request which works). If I use the same QSqlQuery for both but create a new variable to hold the size of the result (numRows2), the call to query.lastQuery returns "CALL toto()" but the call to query.executedQuery return the previous request (which was successful), and numRows2 returns -1 (which is coherent). Nevertheless, the return of the exec function is true and the query.lastError() does not return anything.

    All this is really weird. I guess it is not a MysqlDriver issue otherwise no request would have worked.

    Lynn

Similar Threads

  1. Accessing REF CURSOR in Stored Procedure from Qt
    By sureshbabu in forum Qt Programming
    Replies: 3
    Last Post: 11th August 2010, 15:51
  2. Stored procedure and ODBC
    By filya in forum Qt Programming
    Replies: 2
    Last Post: 15th March 2010, 08:40
  3. problem in using stored procedure
    By zolfaghari in forum Qt Programming
    Replies: 0
    Last Post: 15th March 2010, 08:25
  4. qt how get out parameter of Stored Procedure?
    By yunpeng880 in forum Qt Programming
    Replies: 1
    Last Post: 23rd March 2009, 12:22
  5. Cannot create MySQL stored procedure / views from Qt
    By pshah.mumbai in forum Qt Programming
    Replies: 8
    Last Post: 8th October 2008, 16:22

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.