doc-exports/docs/dws/dev/dws_04_0135.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-16 07:24:04 +00:00

40 lines
6.1 KiB
HTML

<a name="EN-US_TOPIC_0000001188323686"></a><a name="EN-US_TOPIC_0000001188323686"></a>
<h1 class="topictitle1">SQLExecute</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001188323686__sbbad4fc03119403da880a63d829934ba"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001188323686__a49b960777df44eea8be37a86761966a5">The <strong id="EN-US_TOPIC_0000001188323686__b842352706143246">SQLExecute</strong> function executes a prepared SQL statement using <strong id="EN-US_TOPIC_0000001188323686__b53384070162116">SQLPrepare</strong>. The statement is executed using the current value of any application variables that were bound to parameter markers by <strong id="EN-US_TOPIC_0000001188323686__b33148462162129">SQLBindParameter</strong>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323686__s9e74807c43424563930ae4d5b8afc5d9"><h4 class="sectiontitle">Prototype</h4><div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000001188323686__s5c78e33b423a45fbac63659d2d7357bb"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">SQLRETURN</span><span class="w"> </span><span class="nf">SQLExecute</span><span class="p">(</span><span class="n">SQLHSTMT</span><span class="w"> </span><span class="n">StatementHandle</span><span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323686__s2e08e49a3cf246c69ccc9cfc8d9c261e"><h4 class="sectiontitle">Parameter</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188323686__tfa9ca482590f4040bfad76db0618dec2" frame="border" border="1" rules="all"><caption><b>Table 1 </b>SQLExecute parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001188323686__r0307a745cb2d4d4ab43fd9d64913c958"><th align="left" class="cellrowborder" valign="top" width="23.580000000000002%" id="mcps1.3.3.2.2.3.1.1"><p id="EN-US_TOPIC_0000001188323686__a7e885584186d4b029f5a3f6f5f620516">Keyword</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="76.42%" id="mcps1.3.3.2.2.3.1.2"><p id="EN-US_TOPIC_0000001188323686__a0a1b542dea1e4e07946cfdb58beb9754">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001188323686__r42d0ec61c4cf4d83a9e2000fb5c9bd5e"><td class="cellrowborder" valign="top" width="23.580000000000002%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001188323686__ae886ff03870a46cdaafd0c7bf0fca52f">StatementHandle</p>
</td>
<td class="cellrowborder" valign="top" width="76.42%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001188323686__a6e52e14b456a4cf382fc35564898e02e">Statement handle to be executed.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323686__s547adf5e523647d08e970f40c70d0b7d"><h4 class="sectiontitle">Return Values</h4><ul id="EN-US_TOPIC_0000001188323686__u683682627ef745ffba248d532587749b"><li id="EN-US_TOPIC_0000001188323686__lec689920a9dc4575b29d94147896be4b"><strong id="EN-US_TOPIC_0000001188323686__b842352706112950">SQL_SUCCESS</strong> indicates that the call succeeded.</li><li id="EN-US_TOPIC_0000001188323686__l9d1db1a6e3b04dda9f722dfbf500c718"><strong id="EN-US_TOPIC_0000001188323686__b842352706112952">SQL_SUCCESS_WITH_INFO</strong> indicates some warning information is displayed.</li><li id="EN-US_TOPIC_0000001188323686__l6aa4ef7ab4f4411cbff59fbfbf3df2e7"><strong id="EN-US_TOPIC_0000001188323686__b842352706151720">SQL_NEED_DATA</strong> indicates insufficient parameters provided before executing the SQL statement.</li><li id="EN-US_TOPIC_0000001188323686__lb0775eeba70342b19814aa80039fd1da"><strong id="EN-US_TOPIC_0000001188323686__b842352706112954">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection failures.</li><li id="EN-US_TOPIC_0000001188323686__l97d86318d4794d859400ae336060bf42"><strong id="EN-US_TOPIC_0000001188323686__b84235270615213">SQL_NO_DATA</strong> indicates that the SQL statement does not return a result set.</li><li id="EN-US_TOPIC_0000001188323686__l5b5321ccc41a42e28e69859c248d8ece"><strong id="EN-US_TOPIC_0000001188323686__b842352706112956">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the preceding values.</li><li id="EN-US_TOPIC_0000001188323686__le4bea77a33bb416f8f9d28333feb3601"><strong id="EN-US_TOPIC_0000001188323686__b842352706152119">SQL_STILL_EXECUTING</strong> indicates that the statement is being executed.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323686__s3838769b67af4332853f9c75b201f653"><h4 class="sectiontitle">Precautions</h4><p id="EN-US_TOPIC_0000001188323686__afaf75a752a164f1ca564b208fb97b949">If <strong id="EN-US_TOPIC_0000001188323686__b55554383162141">SQLExecute</strong> returns <strong id="EN-US_TOPIC_0000001188323686__b24041446162145">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000001188323686__b39996668162152">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="dws_04_0143.html">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000001188323686__b22187642162157">HandleType</strong> and <strong id="EN-US_TOPIC_0000001188323686__b1385698916223">Handle</strong> to <strong id="EN-US_TOPIC_0000001188323686__b331675816228">SQL_HANDLE_STMT</strong> and <strong id="EN-US_TOPIC_0000001188323686__b55122378162220">StatementHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000001188323686__b38407935162225">SQLSTATE</strong> value. The <strong id="EN-US_TOPIC_0000001188323686__b10797917162230">SQLSTATE</strong> value provides the detailed function calling information.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001188323686__s1e9f8d406841495faf3c1e255d63d2e2"><h4 class="sectiontitle">Examples</h4><p id="EN-US_TOPIC_0000001188323686__a48e447f8de3546ffac780f3e1583a8fb">See <a href="dws_04_0123.html">Examples</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0124.html">ODBC Interfaces</a></div>
</div>
</div>