forked from docs/doc-exports
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>
54 lines
6.6 KiB
HTML
54 lines
6.6 KiB
HTML
<a name="EN-US_TOPIC_0000001188163624"></a><a name="EN-US_TOPIC_0000001188163624"></a>
|
|
|
|
<h1 class="topictitle1">SQLPrepare</h1>
|
|
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001188163624__sf41fe86578184b8abd859b572544cd7b"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001188163624__a0d969dc7cd47485189f751ea43c79e8c"><strong>SQLPrepare</strong> prepares an SQL statement to be executed.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188163624__s8db9f1e098e84e60a8378d60fd5da155"><h4 class="sectiontitle">Prototype</h4><div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000001188163624__s853457826d4148a1a080a50e84707956"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span>
|
|
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">SQLRETURN</span><span class="w"> </span><span class="nf">SQLPrepare</span><span class="p">(</span><span class="n">SQLHSTMT</span><span class="w"> </span><span class="n">StatementHandle</span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">SQLCHAR</span><span class="w"> </span><span class="o">*</span><span class="n">StatementText</span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">SQLINTEGER</span><span class="w"> </span><span class="n">TextLength</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188163624__s6be5baad225d4cada117cf5195aea7b4"><h4 class="sectiontitle">Parameter</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188163624__t4bdd016a4fa94bdf96d13077e15eb8a7" frame="border" border="1" rules="all"><caption><b>Table 1 </b>SQLPrepare parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001188163624__r0824e0ca74be4e1abd734f67ea7c11e5"><th align="left" class="cellrowborder" valign="top" width="23.27%" id="mcps1.3.3.2.2.3.1.1"><p id="EN-US_TOPIC_0000001188163624__a25bae9558849412f9487efe83d2b4eb3">Keyword</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="76.73%" id="mcps1.3.3.2.2.3.1.2"><p id="EN-US_TOPIC_0000001188163624__a7f63ddf954be41a48f15681a4bf97161">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001188163624__r1e13d7d3e6234e8385dfc2aa92d61b4f"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001188163624__a062388ca5b5b44e495098c479862ac3d">StatementHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001188163624__a66b266bfd09640a39ffffaf66fe2ac85">Statement handle.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001188163624__r774064d78bfd4fc0bdb6d8c003a3716d"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001188163624__a191831186bed4c5f89a92b2ce4813f64">StatementText</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001188163624__a62be8f9459644a8eb7b9f0c97b248781">SQL text string.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001188163624__rfb94179b4cfd41aca4477b151ac59c27"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001188163624__a444738741fdf480197a4250bbb914241">TextLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001188163624__a802c3ac447864ca2916bf9646084c025">Length of <strong id="EN-US_TOPIC_0000001188163624__b43579298162725">StatementText</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188163624__s5ef985657b6149a3bb3bda5cb672f832"><h4 class="sectiontitle">Return Values</h4><ul id="EN-US_TOPIC_0000001188163624__uddb3d7bd6c074251a550604a320413e7"><li id="EN-US_TOPIC_0000001188163624__en-us_topic_0059779125_li42881082362"><strong id="EN-US_TOPIC_0000001188163624__b842352706112950">SQL_SUCCESS</strong> indicates that the call succeeded.</li><li id="EN-US_TOPIC_0000001188163624__l53c4e294137e49719c9591323529bf81"><strong id="EN-US_TOPIC_0000001188163624__b842352706112952">SQL_SUCCESS_WITH_INFO</strong> indicates some warning information is displayed.</li><li id="EN-US_TOPIC_0000001188163624__l74107e2596b94b69a7a15a01c1f21b1f"><strong id="EN-US_TOPIC_0000001188163624__b842352706112954">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection failures.</li><li id="EN-US_TOPIC_0000001188163624__lce5993f81c5e42c5850f0bc5831baebb"><strong id="EN-US_TOPIC_0000001188163624__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_0000001188163624__le4bee07f100041ec94e981dc1b2c690b"><strong id="EN-US_TOPIC_0000001188163624__b842352706152119">SQL_STILL_EXECUTING</strong> indicates that the statement is being executed.</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188163624__sc6a05420e8ab42b080a81fd1cd7e7a12"><h4 class="sectiontitle">Precautions</h4><p id="EN-US_TOPIC_0000001188163624__ad80f200ab0fc4e6daf2c235997ef255b">If <strong id="EN-US_TOPIC_0000001188163624__b355637416127">SQLPrepare</strong> returns <strong id="EN-US_TOPIC_0000001188163624__b31683787161212">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000001188163624__b12837117161219">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="dws_04_0143.html">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000001188163624__b60706181161228">HandleType</strong> and <strong id="EN-US_TOPIC_0000001188163624__b36130306161234">Handle</strong> to <strong id="EN-US_TOPIC_0000001188163624__b14022084161240">SQL_HANDLE_STMT</strong> and <strong id="EN-US_TOPIC_0000001188163624__b4894318161249">StatementHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000001188163624__b1846530161256">SQLSTATE</strong> value. The <strong id="EN-US_TOPIC_0000001188163624__b861544416135">SQLSTATE</strong> value provides the detailed function calling information.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188163624__s031deb6edde94059ae913b9ad53ce2b0"><h4 class="sectiontitle">Examples</h4><p id="EN-US_TOPIC_0000001188163624__aaa36de6b21524cf381b9af239d7c45f7">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>
|
|
|