Results 1 to 2 of 2

Thread: stored proc with QtSql

  1. #1
    Join Date
    Mar 2008
    Posts
    15
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default stored proc with QtSql

    Hi,
    Is it possible to call stored procedures stored in MySql using QtSql ?

  2. #2
    Join Date
    Jan 2006
    Posts
    132
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: stored proc with QtSql

    In oracle a procedure call with an in, inout and out parameter would be something as:

    Qt Code:
    1. query->prepare("begin myProcedure(?,?,?) end;");
    2. query->bindValue(0, "foo", QSql::In);
    3. query->bindValue(1, 1234, QSql::InOut);
    4. query->bindValue(2, 0, QSql::Out);
    5. query->exec();
    6.  
    7. QString p2 = query->boundValue(1).toString();
    8. int p3 = query->boundValue(2).toInt();
    To copy to clipboard, switch view to plain text mode 

    I'm not sure about MySQL, but I think the query syntax would instead be:

    Qt Code:
    1. query->prepare("call myProcedure(?,?,?);");
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to seneca for this useful post:

    araglin (23rd August 2009)

Similar Threads

  1. MySql Stored Procedures Woes
    By stevey in forum Qt Programming
    Replies: 9
    Last Post: 19th October 2006, 12:58

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.