<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Calling server stored procedure using binding]]></title><description><![CDATA[<p dir="auto">I am trying to call a MySQL server stored procedure using Qt. The procedure returns multiple rows of data I want to retrieve.</p>
<p dir="auto">The first snippet I tried works fine:</p>
<p dir="auto">QSqlQuery query("CALL GetOrderItems(323)", dataBase);<br />
qDebug() &lt;&lt; query.first();</p>
<p dir="auto">It also returns the desired data and query.first() is true like expected.</p>
<p dir="auto">Then I tried to insert the parameter using parameter binding like the Qt documentation proposes. I tried the following snippets. The first uses index placeholder the second keyword placeholder.</p>
<p dir="auto">QSqlQuery query(dataBase);<br />
qDebug() &lt;&lt; query.prepare("CALL GetOrderItems(?)");<br />
query.bindValue(0, 323);<br />
qDebug() &lt;&lt; query.exec();<br />
qDebug() &lt;&lt; query.first();</p>
<p dir="auto">QSqlQuery query(dataBase);<br />
qDebug() &lt;&lt; query.prepare("CALL GetOrderItems(:myparam)");<br />
query.bindValue(":myparam", 323);<br />
qDebug() &lt;&lt; query.exec();<br />
qDebug() &lt;&lt; query.first();</p>
<p dir="auto">Both of these queries execute fine. But query.first() returns false so I don't know how to get the results.</p>
<p dir="auto">Can I get the result from the binding queries in some way? Why doesn't this work?</p>
]]></description><link>https://forum.qt.io/topic/47188/calling-server-stored-procedure-using-binding</link><generator>RSS for Node</generator><lastBuildDate>Sun, 20 Sep 2026 19:08:58 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/47188.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 19 Oct 2014 09:56:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Calling server stored procedure using binding on Sun, 19 Oct 2014 10:25:00 GMT]]></title><description><![CDATA[<p dir="auto">Hm. Seems this is simply not supported. Binding values in Qt/MySQL are almost uselss :-(</p>
<p dir="auto">This is my original thread in stackoverflow: <a href="http://stackoverflow.com/questions/26448906/calling-server-stored-procedure-using-binding" target="_blank" rel="noopener noreferrer nofollow ugc">http://stackoverflow.com/questions/26448906/calling-server-stored-procedure-using-binding</a></p>
]]></description><link>https://forum.qt.io/post/248192</link><guid isPermaLink="true">https://forum.qt.io/post/248192</guid><dc:creator><![CDATA[silicomancer]]></dc:creator><pubDate>Sun, 19 Oct 2014 10:25:00 GMT</pubDate></item></channel></rss>