forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: luhuayi <luhuayi@huawei.com> Co-committed-by: luhuayi <luhuayi@huawei.com>
946 lines
178 KiB
HTML
946 lines
178 KiB
HTML
<a name="EN-US_TOPIC_0000002044151968"></a><a name="EN-US_TOPIC_0000002044151968"></a>
|
|
|
|
<h1 class="topictitle1">ODBC Interfaces</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ad17e854087844a84a4debce53f558fcd">The ODBC interface is a set of API functions provided to users. This chapter describes its common interfaces. For details on other interfaces, see "ODBC Programmer's Reference" at MSDN (https://msdn.microsoft.com/en-us/library/windows/desktop/ms714177(v=vs.85).aspx).</p>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section77521725122914"><h4 class="sectiontitle">SQLAllocEnv</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aa8c929a46bc74b72b8d6365f32ee8150">In ODBC 3.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i13131611657">x</em>, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1996015571944">SQLAllocEnv</strong> (a function in ODBC 2.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i1558710456">x</em>) was deprecated and replaced by <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b11960205719415">SQLAllocHandle</strong>. For details, see <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section19259553162912">SQLAllocHandle</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section83174142913"><h4 class="sectiontitle">SQLAllocConnect</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ac3254d8cd5674bc6b278710338f58b3e">In ODBC 3.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i18782163516913">x</em>, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b42472280463756">SQLAllocConnect</strong> (a function in ODBC 2.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i914419281220">x</em>) was deprecated and replaced by <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b143589810463756">SQLAllocHandle</strong>. For details, see <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section19259553162912">SQLAllocHandle</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section19259553162912"><a name="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section19259553162912"></a><a name="en-us_topic_0000001188163746_section19259553162912"></a><h4 class="sectiontitle">SQLAllocHandle</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p29466228302"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1295382410011">Function</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a33f5aa294ea944bca79407a62872c608"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1369983531211">SQLAllocHandle</strong> allocates environment, connection, or statement handles. It replaces the ODBC 2.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i07351258137">x</em> functions <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b96521540151314">SQLAllocEnv</strong>, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b6394134414138">SQLAllocConnect</strong>, and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b114907498133">SQLAllocStmt</strong>.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p13933922113018"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b645712711347">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_s256ead0928ef4544972f08eeb3a543c5"><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">SQLAllocHandle</span><span class="p">(</span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">HandleType</span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">SQLHANDLE</span><span class="w"> </span><span class="n">InputHandle</span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">SQLHANDLE</span><span class="w"> </span><span class="o">*</span><span class="n">OutputHandlePtr</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p791212212300"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b133414187346">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_t0d4910c942154745837dfa85177f3167" frame="border" border="1" rules="all"><caption><b>Table 1 </b>SQLAllocHandle parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r59119f94d26b4176b7c01f42177a24dc"><th align="left" class="cellrowborder" valign="top" width="23.27%" id="mcps1.3.4.7.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a78d3cb080a2b411ab32cf5c9dbdcceca"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b725616319357">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="76.73%" id="mcps1.3.4.7.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab97dfdcd2f164f9dade3959977ce15cf"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b15277519153513">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_racbffbbfef2e4fef93a8912e7d106868"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.4.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a7e09ea9293da4c20ba20afbfa33941e8">HandleType</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.4.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a74aaef5484644d9f8a8e862a9cf7d7b1">Handle type allocated by <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b15911181991611">SQLAllocHandle</strong>. The value must be one of the following:</p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ucfe408da9d6b4075b02f694345336b0d"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_la59247d92a5a46adab3ee67f5c84e951"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b4165194141618">SQL_HANDLE_ENV</strong> (environment handle)</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l733bebe9f2b140d8aee2ba9ddcab236b"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b746824510164">SQL_HANDLE_DBC</strong> (connection handle)</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ld381ad0ac6b9471e833f90eeda64d989"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b10751512160">SQL_HANDLE_STMT</strong> (statement handle)</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lb9a25f4f86c740a5b51bc48ad695b1fd"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b511705713165">SQL_HANDLE_DESC</strong> (description handle)</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a33635347f5d8480abda63daf8c4d3127">The handle application sequence is: <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b9255131013178">SQL_HANDLE_ENV</strong> > <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b182551810111713">SQL_HANDLE_DBC</strong> > <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b92563107173">SQL_HANDLE_STMT</strong>. The handle applied later depends on the handle applied prior to it.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r1bf317e27dc7413a8142e9a42a1b9da9"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.4.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9c3b2c2e82474819b02069e26c84ea17">InputHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.4.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a7e264449e6e34f74996c913df229406a">Type of the new handle to be allocated.</p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ud2d234c90dde4803adcf3e0e2b8c176b"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_le4f36bcc31234d2c9e66b629b5384fed">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b43661542263756">HandleType</strong> is <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b32696487563756">SQL_HANDLE_ENV</strong>, the value is <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b82279130199">SQL_NULL_HANDLE</strong>.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l245a5cee8fea4326979a4dd87960484b">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b47589459763756">HandleType</strong> is <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b178646636663756">SQL_HANDLE_DBC</strong>, this must be an environment handle.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l912e43c41ae14b63a5d5b68d8cf8481d">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b110261328863756">HandleType</strong> is <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b60770447063756">SQL_HANDLE_STMT</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b176657357463756">SQL_HANDLE_DESC</strong>, it must be a connection handle.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r98c21810476943b0979e186546370a56"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.4.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aed5176c91cbc45178aae397d86ee1d01">OutputHandlePtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.4.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af677ff303a7d4dba9461d18e4efb2a39"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a7c5d99c39994413b87dbbeecf840371c">Output parameter</strong>: Pointer to a buffer in which the handle returned for the newly allocated data structure is stored.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1190572233013"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b123361414145214">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ufc2666f3c8fa4d338e61ef60300bb199"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l796deb1f252a43dfbacbbe06a840ccee"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b208641430132512">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l212edd7d305c463389d6a14f2e2e8ffc"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b151958139488">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lfd2996918e6448e98c1c34e8613d0834"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b6180112313265">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l4544f9ead5f047f089fb39c21fde0c91"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b19165173619266">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p39001222103011"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b243571142713">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a6bb4f94a2cd04af58391506fcc280e50">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b15201240103316">SQLAllocHandle</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b13424659374">SQL_ERROR</strong> when it is used to allocate a non-environment handle, it sets <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1742513533715">OutputHandlePtr</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1425358378">SQL_NULL_HDBC</strong>, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b2042510511370">SQL_NULL_HSTMT</strong>, or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b19425554373">SQL_NULL_HDESC</strong>. The application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b10876163917379">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b11529144353716">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b2056164753718">IntputHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b948116535379">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1689711221303"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b111817569019">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a0c0d4b06069142cfa00b8d50b65c86c3">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p761417549295"></p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section18712595306"><h4 class="sectiontitle">SQLAllocStmt</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a0d4acad42c554f76bbf3e08f05d4e24c">In ODBC 3.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i3662181513409">x</em>, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b766241514011">SQLAllocStmt</strong> (a function in ODBC 2.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i126631315194012">x</em>) was deprecated and replaced by <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b5663151544011">SQLAllocHandle</strong>. For details, see <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section19259553162912">SQLAllocHandle</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section318515153112"><h4 class="sectiontitle">SQLBindCol</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p7590175103217"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b695512411010">Function</strong></p>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a3825c56431864148835e945434b52ca3"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b8468114025814">SQLBindCol</strong> is used to associate (bind) columns in a result set to an application data buffer.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p6106164318320"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b124591703419">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_scced094bd8844ca89c6bb56115b29f0e"><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>
|
|
<span class="normal">4</span>
|
|
<span class="normal">5</span>
|
|
<span class="normal">6</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">SQLRETURN</span><span class="w"> </span><span class="nf">SQLBindCol</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">SQLUSMALLINT</span><span class="w"> </span><span class="n">ColumnNumber</span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">TargetType</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLPOINTER</span><span class="w"> </span><span class="n">TargetValuePtr</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLLEN</span><span class="w"> </span><span class="n">BufferLength</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLLEN</span><span class="w"> </span><span class="o">*</span><span class="n">StrLen_or_IndPtr</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1992152193215"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1536151814345">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_t74ba715562be4ad688da27a8580011e8" frame="border" border="1" rules="all"><caption><b>Table 2 </b>SQLBindCol parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rbcc19508f2c940a0bee483ad7b2fefca"><th align="left" class="cellrowborder" valign="top" width="23.27%" id="mcps1.3.11.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a4c8c5f4926bb4d379596a8ab558d47ca"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1625710353514">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="76.73%" id="mcps1.3.11.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a5ce21a3923614ae3a25c4e8c99e7a986"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b8279151953511">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r3037603acd194bf6aec2a8380f61b368"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.11.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af69021543f4743e5ac70b92f782f5d46">StatementHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.11.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a74a06dedfffe4739a74604881a5e2d76">Statement handle.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r7b5a143f27b04fe791f33944cf129f00"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.11.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_afc6c45e255344626a75fbc7464b1c6d9">ColumnNumber</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.11.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a96794412a876453591bbefae760f7599">Number of the column to be bound. Column numbering begins at 0 and increases in ascending order. Column <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b151201320904">0</strong> functions as the bookmark. If no bookmark column is set, column numbering begins at 1 instead.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rc48d4ebf7e3345b88480505b07e17efb"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.11.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aebfbe4e7af2848979a6381723957066b">TargetType</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.11.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a4ba3156029734fddae1941bd4b1971a7">The C data type in the buffer.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r0aad64522e1f4a908675fd7b04cea85e"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.11.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a6270e066f48d4fcb8eee1fc7ce216a99">TargetValuePtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.11.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ad8981bafaf644db985631f8151a4458d"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a2ec95c1da9ad4044ba123c1a687efc25">Output parameter</strong>: pointer to the buffer bound with the column. The <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b147368919319">SQLFetch</strong> function returns data in the buffer. If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b105260462363756">TargetValuePtr</strong> is null, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b211166611863756">StrLen_or_IndPtr</strong> is a valid value.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r6d64eb8beece430abadf7d52bd739292"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.11.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ac2cd8c4e2e064745be4228ad93cfd647">BufferLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.11.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a54d9da91d79d4cd3af614b5e6e6e3d9c">Length of the buffer to which <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b34451351430">TargetValuePtr</strong> points, in bytes.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r698245daaffb4d0e828719d74e4880b9"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.11.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a1d6bedea7e8d4f18bbad60e740b67fac">StrLen_or_IndPtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.11.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a3c1793e03cf74f4f992433d2d9efc2b4"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a66304b5af704493bbe7b716fc988981e">Output parameter</strong>: pointer to the length or indicator of the buffer. If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b67641711192618">StrLen_or_IndPtr</strong> is null, no length or indicator is used.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p36752393310"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b15338171420529">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u880e8cb338d448d09679b978e3f84414"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_en-us_topic_0059779335_li99448223177"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b586683019254">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l88a3443d2e1e44fe9548161f9bd25439"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b191971513114815">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l69ae8daeb8034c5bb82ed75011ea1c14"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b5181223182612">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l04bd47d7e76344d7b67f63654e65c8b1"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b19167036192618">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1225418166337"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1331213201415">Note</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_afcdd3e26e54d4d4aab67a91bb3ea4afb">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b159319227271">SQLBindCol</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b8932722202711">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b193212224274">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b139321222102715">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b49325227271">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b393210223270">SQL_HANDLE_STMT</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b10932102218271">StatementHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1393242252720">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p13400183273320"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b021155613013">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aa41e08e7ee4c4b0fa60d7e25fdaa6089">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2192134619335"><h4 class="sectiontitle">SQLBindParameter</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p14471244348"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b169571245011">Function</strong></p>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae092539ba74045bdb7c319e375390f29"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1866704512510">SQLBindParameter</strong> binds a parameter flag in an SQL statement to a buffer.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p557817119347"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b24619710344">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_s9b7797d8b76f4ca6bfd670511c03224f"><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>
|
|
<span class="normal"> 4</span>
|
|
<span class="normal"> 5</span>
|
|
<span class="normal"> 6</span>
|
|
<span class="normal"> 7</span>
|
|
<span class="normal"> 8</span>
|
|
<span class="normal"> 9</span>
|
|
<span class="normal">10</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">SQLRETURN</span><span class="w"> </span><span class="nf">SQLBindParameter</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">SQLUSMALLINT</span><span class="w"> </span><span class="n">ParameterNumber</span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">InputOutputType</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">ValuetType</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">ParameterType</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLULEN</span><span class="w"> </span><span class="n">ColumnSize</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">DecimalDigits</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLPOINTER</span><span class="w"> </span><span class="n">ParameterValuePtr</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLLEN</span><span class="w"> </span><span class="n">BufferLength</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLLEN</span><span class="w"> </span><span class="o">*</span><span class="n">StrLen_or_IndPtr</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p49198246347"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b16385186341">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_t403eeefff7104f72a776d893ed920321" frame="border" border="1" rules="all"><caption><b>Table 3 </b>SQLBindParameter</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rc2f5f2f5dca14eb4ae1e93df660ef5e1"><th align="left" class="cellrowborder" valign="top" width="24.5%" id="mcps1.3.23.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a4ffd671fa01e4e47bbfe51a1e6ff3f28"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1060214401771">Keyword</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="75.5%" id="mcps1.3.23.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a144184a337564c8db819e4748145d7f2"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b42811919173516">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rf0989ef44bd64abfb0f969887e23ddab"><td class="cellrowborder" valign="top" width="24.5%" headers="mcps1.3.23.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_afa7a3c5f245c45dea28f647aace62da6">StatementHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.5%" headers="mcps1.3.23.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae597779ea1b84dadbe811de2e9f11df4">Statement handle.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rd5e1982319fe4e9981b376513198ec56"><td class="cellrowborder" valign="top" width="24.5%" headers="mcps1.3.23.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a7e83b7044a954afc96e62fa105b67815">ParameterNumber</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.5%" headers="mcps1.3.23.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab7198768064548159f471ffe56a6b288">Parameter marker number, starting at 1 and increasing in an ascending order.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r023f6573264e4b3eb5c5013d2c2d6836"><td class="cellrowborder" valign="top" width="24.5%" headers="mcps1.3.23.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a568f617fefdf4e8a969523e7aeb71434">InputOutputType</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.5%" headers="mcps1.3.23.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_abeb07eac955545c1a2e7454fccab5b06">Input and output parameter types.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rcc8fb6ba147a460f9149178ae62e7318"><td class="cellrowborder" valign="top" width="24.5%" headers="mcps1.3.23.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a4ddb6092b3404be7bc0ac819fa857be2">ValueType</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.5%" headers="mcps1.3.23.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a7b8402cd8e5340a69f841ec7849c4453">C data type of the parameter.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rfc425988138749afbb7b08dfd2d43fe8"><td class="cellrowborder" valign="top" width="24.5%" headers="mcps1.3.23.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9cdb87df0ff3433fbc3ebf5195aff068">ParameterType</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.5%" headers="mcps1.3.23.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a246b076de00e4ff295e43f5a510cd70d">SQL data type of the parameter.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r8004a8ee1eaa450fb672d961b6ba56a4"><td class="cellrowborder" valign="top" width="24.5%" headers="mcps1.3.23.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a8b7c635a7f744dfd9c4e96ef0b498280">ColumnSize</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.5%" headers="mcps1.3.23.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_adf60a9a495184d35bcbefb2456e547e7">Column size or the expression of the corresponding parameter marker.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rd386e1c43f2e482086c77e948591c956"><td class="cellrowborder" valign="top" width="24.5%" headers="mcps1.3.23.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9f0d62c791dc48a091229ff8901c2d48">DecimalDigits</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.5%" headers="mcps1.3.23.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a5dc25ad5fff54a9bbee6466fdc030de4">Decimal number of the column or the expression of the corresponding parameter marker.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r12611421e1b94796abb5c7dbccde4387"><td class="cellrowborder" valign="top" width="24.5%" headers="mcps1.3.23.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a635aca171684440b9f983d1488d0cf19">ParameterValuePtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.5%" headers="mcps1.3.23.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9a26fc96c2ed4adcbb26f5b141d8bfda">Pointer to the buffer for storing parameter data.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rb696695d56e241be9f7a275c7d5dd138"><td class="cellrowborder" valign="top" width="24.5%" headers="mcps1.3.23.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a48f7a78b62b04c5dbb0825c5bf243dd5">BufferLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.5%" headers="mcps1.3.23.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a37615d2ec6294f13a357b5b1d7703b4b">Length of the buffer to which the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b3704164412232">ParameterValuePtr</strong> points, in bytes.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r0c685b9c2cc74ab5afb5c62c951d3714"><td class="cellrowborder" valign="top" width="24.5%" headers="mcps1.3.23.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae1fb3d6ede894b239f88706c64b360c5">StrLen_or_IndPtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.5%" headers="mcps1.3.23.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_acbe2efecc2c34dbaa8f16268c2a51106">Pointer to the length or indicator of the buffer. If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b487081392514">StrLen_or_IndPtr</strong> is null, no length or indicator is used.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1919134163417"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b93407143529">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_uacc4f1eced2d4bacb91206a652782be1"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_en-us_topic_0059778788_li44335342173"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b13653920142518">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l46485823318e4d97a165f233faa479b5"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b142001813184816">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l1b98d8384e524156b90696a7e66a1df6"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b14814141842614">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l784c0349c5cd46deb2545e186ab72859"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b12960432102617">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1390174220346"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1481317577265">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a16a2128b0a7e4f9193a688cb9ca84df8">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b8687614153610">SQLBindCol</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b86889148364">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b868818148364">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b669041414367">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b869010148366">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b186911914113617">SQL_HANDLE_STMT</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b196915145366">StatementHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1669261403616">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1045925443418"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b9220561001">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_afe658d9a8f454f6ba6c63cf3105ba781">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p443711015358"></p>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section1294720353518"><h4 class="sectiontitle">SQLColAttribute</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1390915317359"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b595917241909">Function</strong></p>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a0f3f9d55ba764377bd7ef3797dfd2a8a"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b39759358963756">SQLColAttribute</strong> returns the descriptor information about a column in the result set.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p16491743113515"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1862635611332">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_s5479e5b300e9479f8451584bd7eb8c3b"><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>
|
|
<span class="normal">4</span>
|
|
<span class="normal">5</span>
|
|
<span class="normal">6</span>
|
|
<span class="normal">7</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">SQLRETURN</span><span class="w"> </span><span class="nf">SQLColAttribute</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">SQLUSMALLINT</span><span class="w"> </span><span class="n">ColumnNumber</span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">SQLUSMALLINT</span><span class="w"> </span><span class="n">FieldIdentifier</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLPOINTER</span><span class="w"> </span><span class="n">CharacterAtrriburePtr</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">BufferLength</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="o">*</span><span class="n">StringLengthPtr</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLPOINTER</span><span class="w"> </span><span class="n">NumericAttributePtr</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p18642165610359"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b14628121414344">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_t581b932a1147405e8eab20a6ac4641e1" frame="border" border="1" rules="all"><caption><b>Table 4 </b>SQLColAttribute parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r4102d38435b54d4e9d19c59f39dae3bd"><th align="left" class="cellrowborder" valign="top" width="26.86%" id="mcps1.3.36.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae066649e554249269df453e8a546b3ae"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1292115292348">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="73.14%" id="mcps1.3.36.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9ac72f56abd745f7b56961856e0c600d"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b125614167353">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r6190770ce4094d3faa269b466bf02bd0"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.36.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab328282db77c4e14a5e43b6814d833ab">StatementHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.36.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a08a913d238ac47fab41c0eb9c4c671f2">Statement handle.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rf31337efcf1743ac966c0e15e9e4f2c3"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.36.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a7ab12c6f403f4e0f9d592cf6cad47a64">ColumnNumber</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.36.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aa5c3a330c25a4b0bba5fae10daba67dc">Column number of the field to be queried, starting at 1 and increasing in an ascending order.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r7319fb99008a4790980d6e52808c4578"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.36.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a47a3ebc7e8104e198cf3ea410824f555">FieldIdentifier</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.36.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab4a5659ffaa34f4d934020b8f5c68370">Field identifier of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b12524773614">ColumnNumber</strong> in IRD.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rce8ce58273544bc0968131d5f050a0b0"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.36.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a1f4606574769444792b6c86b3df54657">CharacterAttributePtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.36.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a8ca6e492401945d29ab449a5cfe86c3f"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a1f229324bcf5485cbfea6ea0e28306ad">Output parameter</strong>: pointer to the buffer that returns FieldIdentifier field value.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r30ea1ae688d94331ae48e99ca205ee05"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.36.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aaf54e54133bd479f8d3bc876503ca985">BufferLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.36.2.3.1.2 "><ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u824d03b5d21b4e13b27850082534800f"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l951fe2f02fb34fdc9d1b0090f84e80f3"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b462934163918">FieldIdentifier</strong> indicates the buffer length when it refers to an ODBC-defined field and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1236135219468">CharacterAttributePtr</strong> points to a string or binary buffer.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l52558aab73e14afe9bba6d0b54929a45">Ignore this parameter if <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b102554731663756">FieldIdentifier</strong> is an ODBC-defined field and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b81392603663756">CharacterAttributePtr</strong> points to an integer.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r7c5edec8647542e696567e4a9a865b19"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.36.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a0a6dc36333934ca38cfa0dc3e22c0357">StringLengthPtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.36.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a399afae0358747428dd4c73d74c9c861"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b134185020763756">Output parameter</strong>: pointer to a buffer in which the total number of valid bytes (for string data) is stored in <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b46931226263756">*CharacterAttributePtr</strong>. Ignore the value of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b13047053363756">BufferLength</strong> if the data is not a string.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r3b058a8d3f1644ac84b7f83c1e6dff03"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.36.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a7c7cb293ba43457690c86e2b3fed0c76">NumericAttributePtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.36.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a8d78d328caab4efd938619699b051ecd"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b187992395472">Output parameter</strong>: pointer to an integer buffer in which the value of the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b197997391474">FieldIdentifier</strong> field in the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b188001839114714">ColumnNumber</strong> row of the IRD is returned.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p122732303619"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b113426144525">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u277232ee0053430db2e025cc522e1085"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l760fc3ee86ee4b0296e08dfd9ea4a510"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b986813012511">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l27f2f5049a24485a9013a20de6df2702"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b17686178184811">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lde9bd9b7916442618bd1cf58d05ad38f"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1418392316267">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ld7bd6a9868cb4a91917d023573f2e615"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b20169836202615">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p299418110363"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1843715117278">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a6acfa42946c44c4dabfcd388f14e318d">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1258115254367">SQLColAttribute</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b6581425153614">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1558116256368">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b5581152511366">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b7582122519364">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b258213251368">SQL_HANDLE_STMT</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b3582825173613">StatementHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1458213251360">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1350719113617"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b16248565016">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a3847a8343fd94e488a00e3619090c16b">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section138981826113614"><h4 class="sectiontitle">SQLConnect</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p208351945183611"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b179601241802">Function</strong></p>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a1f242adaa56e4a6b93c4cb87ac96530c"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b18104138155019">SQLConnect</strong> establishes a connection between a driver and a data source. Using the connection handle, you can obtain crucial information like the program's status, transaction processing status, and error messages after establishing a connection to the data source.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p31132052143610"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b14462107173413">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_se18cf396ab474386befea701ed018787"><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>
|
|
<span class="normal">4</span>
|
|
<span class="normal">5</span>
|
|
<span class="normal">6</span>
|
|
<span class="normal">7</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">SQLRETURN</span><span class="w"> </span><span class="nf">SQLConnect</span><span class="p">(</span><span class="n">SQLHDBC</span><span class="w"> </span><span class="n">ConnectionHandle</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLCHAR</span><span class="w"> </span><span class="o">*</span><span class="n">ServerName</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">NameLength1</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLCHAR</span><span class="w"> </span><span class="o">*</span><span class="n">UserName</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">NameLength2</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLCHAR</span><span class="w"> </span><span class="o">*</span><span class="n">Authentication</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">NameLength3</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p12296535377"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1540318133410">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_t77a51b99c46c40a4824209954acfa6ea" frame="border" border="1" rules="all"><caption><b>Table 5 </b>SQLConnect parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r1f818d6f5a4148cdb029adf8b0ec5c9b"><th align="left" class="cellrowborder" valign="top" width="24.04%" id="mcps1.3.48.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab383be05782d44a9976e7cce8df60bac"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b182594383516">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="75.96000000000001%" id="mcps1.3.48.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a96cb56691f8c44b9896e95352276ceda"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b20282191983514">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r2d0ddea03bef4b008263acb279ad7e9c"><td class="cellrowborder" valign="top" width="24.04%" headers="mcps1.3.48.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aa1133bd7c638491f9829077a7d51c1fc">ConnectionHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.96000000000001%" headers="mcps1.3.48.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a6e95f84a9c94479ca6e62b2be8983def">Connection handle, obtained from <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b158615497565">SQLAllocHandle</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r310134a176464be9a400095e04c7e841"><td class="cellrowborder" valign="top" width="24.04%" headers="mcps1.3.48.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a0832f6d4b3b64171ab8e4c49ae84522d">ServerName</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.96000000000001%" headers="mcps1.3.48.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a6afecc2ce3814149bef6b7171a13f06d">Name of the data source to connect to.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r0f36a2af1fc748efa2eab37f6d6403c4"><td class="cellrowborder" valign="top" width="24.04%" headers="mcps1.3.48.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a486f91a03bb74112b8084909b2967f16">NameLength1</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.96000000000001%" headers="mcps1.3.48.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a5f5c3b899744421f83cf0978b70a89c7">Length of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b140546803163756">ServerName</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r8ad150769f2449728d790cf5d274f02d"><td class="cellrowborder" valign="top" width="24.04%" headers="mcps1.3.48.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a4021c1d274ed4ee29dbacd40b6559c17">UserName</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.96000000000001%" headers="mcps1.3.48.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a82702c89c23945e8ac043dc6bbc2a8dd">Database username in the data source.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r1306ee34ae4245f9b487cdf04a1d75d8"><td class="cellrowborder" valign="top" width="24.04%" headers="mcps1.3.48.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a038ebe78fed74b038a35a82c687ca0a3">NameLength2</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.96000000000001%" headers="mcps1.3.48.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a3d787b3b7132444e8d335cd57a696d66">Length of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b173151903763756">UserName</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r141d433419e84c09bc951fe31cace31b"><td class="cellrowborder" valign="top" width="24.04%" headers="mcps1.3.48.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aed1aaf7b9845494aa6db182891670754">Authentication</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.96000000000001%" headers="mcps1.3.48.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aea2340d02b014c52843f20428b7f0072">Password of the database user in the data source.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r9bf110cb745b41bb9ba6cadef991c312"><td class="cellrowborder" valign="top" width="24.04%" headers="mcps1.3.48.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_adef476f6589347a493a35f59914f8f99">NameLength3</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.96000000000001%" headers="mcps1.3.48.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae25374508eba469fae18b593ae6ca63c">Length of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b62541535552">Authentication</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p196981823713"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b143441514105219">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ub9c9fc70670540eb879c0f394cb004ef"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l239af920a47448f58ed319a51c567634"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b58701230182517">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ld17757f115c347008c771bbf04de506e"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b520281313488">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l5345b6d7076e4ddeb1b3212cdaa4f661"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b31843234262">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_le247724695914ffaa3cb7e97af1392d3"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b17170103652612">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l25aee58a6f764b7c80ce38a49681c66b"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b36501468597">SQL_STILL_EXECUTING</strong> indicates that the statement is being executed.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p881613257374"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b143916114271">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae5b423b2f243492ab3fafb3fa8f11530">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b14807420105520">SQLConnect</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b780792015510">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b58071220165518">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1080832019554">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1180815206553">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b98081120185516">SQL_HANDLE_DBC</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b78081420145515">ConnectionHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1880911207551">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p156422324372"></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p4962932173713"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b32518561503">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a8f36cfb9bcb24256bc9a5ddbe6aa4c6f">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section11556124993713"><h4 class="sectiontitle">SQLDisconnect</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p20792163811383"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b9962102419016">Function</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a7b05a1c0884449efbd9ff6dd30436b7c"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b582743414568">SQLDisconnect</strong> closes the connection associated with the database connection handle.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1078617387386"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1146410713418">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_sbcdd345c2e6447fbb0bf7d9ce3b97eaf"><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">SQLDisconnect</span><span class="p">(</span><span class="n">SQLHDBC</span><span class="w"> </span><span class="n">ConnectionHandle</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p577743811383"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b13426185340">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_t239f9d4d2a9249fd9810285c2e578131" frame="border" border="1" rules="all"><caption><b>Table 6 </b>SQLDisconnect parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r99dcc7bb455c4c208d403cb06e0a7ca7"><th align="left" class="cellrowborder" valign="top" width="24.5%" id="mcps1.3.56.7.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a37dedce720394783b130c527805bfa53"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b52606353519">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="75.5%" id="mcps1.3.56.7.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_add616eee14c14abcab2dc0105a61c401"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b122841219143514">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rf7b521eb51ef46ed99994b484891fa44"><td class="cellrowborder" valign="top" width="24.5%" headers="mcps1.3.56.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9590a4d2550d4e4cb3b8a8174b89cffa">ConnectionHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="75.5%" headers="mcps1.3.56.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a17eb9eb72138410b8281b2740b155659">Connection handle, obtained from <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b27884444568">SQLAllocHandle</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p8771153810381"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b18346314155219">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u8f22d0ccdeb84678ba94d9a39c03f243"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l89e5ec3489724c21a6426bf86c48a653"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b48724308250">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l12ad0925028040feb18408d081ecd2eb"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1320481311481">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l0b3909cb3bb3446e97232c9aa7a20328"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b111856233265">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l397bf74a50cc438db4d1149605e58af8"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1717210369269">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p10768143853811"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b164405110273">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ace882cb8bf4a44b0a950925d46168278">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b4660133213572">SQLDisconnect</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1766083220572">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b12660732175714">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b766043213579">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b18660632135712">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1166193225716">SQL_HANDLE_DBC</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b56611732195711">ConnectionHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b5661153295715">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p57641738153811"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1927756604">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a903c0123f3f94c2cb2ff04b1f7b6acb8">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p20573125033711"></p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section33399476399"><h4 class="sectiontitle">SQLExecDirect</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p69573016407"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b79638246017">Function</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ac463d6213ed54968b393222705da569d"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b7513116145810">SQLExecDirect</strong> executes a prepared SQL statement specified in this parameter. This is the fastest execution method for executing only one SQL statement at a time.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p119496034017"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b746697103414">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_sbc01996d19cb45228a31754bae4dca91"><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">SQLExecDirect</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="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>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p194010204015"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1344111893411">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_t2b44e01bcb7f4c37a37b5405d63d0032" frame="border" border="1" rules="all"><caption><b>Table 7 </b>SQLExecDirect parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rdeba87266ce34b5e8e2d1278e76f2420"><th align="left" class="cellrowborder" valign="top" width="23.580000000000002%" id="mcps1.3.57.7.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_add532d951b99421b98fefaec6a1baa2d"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b826143163512">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="76.42%" id="mcps1.3.57.7.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af6e0d121e5c44578b25cf751a50eaf84"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b132851319163510">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ra69162da656e4c25b59b0f8de1209787"><td class="cellrowborder" valign="top" width="23.580000000000002%" headers="mcps1.3.57.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9adf410480fe4599aa21d8682d32e09c">StatementHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.42%" headers="mcps1.3.57.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a3b9dbfe5ea4446f5ac71163a3cb01a9e">Statement handle, obtained from <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b193215525320">SQLAllocHandle</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r5118d87aa2004309ae1405593f700967"><td class="cellrowborder" valign="top" width="23.580000000000002%" headers="mcps1.3.57.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a6db8d9b2568347d5a3fedb187a20aa84">StatementText</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.42%" headers="mcps1.3.57.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ac3359053af0d4635a62756f7150f10ad">SQL statement to be executed. One SQL statement can be executed at a time.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rcbfcf1bfb2e84a78affec1a07f258397"><td class="cellrowborder" valign="top" width="23.580000000000002%" headers="mcps1.3.57.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae43a78c7e7584bb0b3780a1dae3cf2e6">TextLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.42%" headers="mcps1.3.57.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a4605247bd120439a84e23883694d289d">Length of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b745991101014">StatementText</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1493480204011"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b123486143524">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u117895b288da486482ff5b9ca8b02e6a"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ld0ddcc1319fc46d6a08f41d740c080c0"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b988211307259">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l1035de5855174641aaa42c7f3e8884f5"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b820641318487">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l5eab9ecdea7b48398dcddf50d20178be"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b15555135995817">SQL_NEED_DATA</strong> indicates that there are not enough parameters provided to execute the SQL statement.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l52db7a34587d47ab8996578414b965e9"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b2186623192612">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l926c1cf9e66240a2941916833778c1b5"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b12173536102611">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l8c1b609816ec4e588a0a734fc457e413"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b5627341165910">SQL_STILL_EXECUTING</strong> indicates that the statement is being executed.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ld0fd0881cb3a451b81189f43539a07d3"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1382511110311">SQL_NO_DATA</strong> indicates that no result set is returned for the SQL statement.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p493116011409"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b19441716279">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a89016b2f0e5749a8bc697c7eee8045bf">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b55591527153719">SQLExecDirect</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b656082763719">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b16560192719372">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b135613279371">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b12562152718370">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b105621627133711">SQL_HANDLE_STMT</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b17563142713712">StatementHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b115631327123710">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1692860134014"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b92875617010">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a271816c70047481e97aa291bcda0bfcc">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section8903132311403"><h4 class="sectiontitle">SQLExecute</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p287511366409"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b199651324005">Function</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af7ed48b0bbc14817ab7da6d7718985bd">When a statement includes a parameter marker, the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1529124719116">SQLExecute</strong> function executes a prepared SQL statement using the current value of the marker.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p128691036164013"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1046813763418">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_s9f0f5b5bca944e149bfe7ea705ec3995"><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>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p386123634019"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b194541813410">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_tede06397d6ed45368308b7e5e045afd6" frame="border" border="1" rules="all"><caption><b>Table 8 </b>SQLExecute parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_raab056c2ef244abeba9ef1f03b497713"><th align="left" class="cellrowborder" valign="top" width="23.580000000000002%" id="mcps1.3.58.7.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae8ce41eb76b34d84a6c2b6b905d7b904"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b626212315350">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="76.42%" id="mcps1.3.58.7.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af8f9424bdf594c80a5b0905ecff32d23"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b8286101919352">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ra06f1acb179e47bcadeeec05fec0e295"><td class="cellrowborder" valign="top" width="23.580000000000002%" headers="mcps1.3.58.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a0f753276167d41c5a51469ea2c4933b8">StatementHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.42%" headers="mcps1.3.58.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a96a4f5894d0a46159006e205aea17d05">Statement handle to be executed.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p58566367408"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b3350131416521">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u6e58910e457345e28c356e443ad82f6a"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l6fe7b86f190244ff9e34123bb666ce64"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b11883630182510">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l023e86988bed489caa77ba8c3d98cd00"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b8209161334819">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lad9e6f2d49d14a6c85891ef478078604"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b78291410963756">SQL_NEED_DATA</strong> indicates that there are not enough parameters provided to execute the SQL statement.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l78581f937e9b472ea9671f2ff4abb637"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b15187152315262">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l190d06f1d2694f65aadd98eedd1d3204"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b789317532211">SQL_NO_DATA</strong> indicates that no result set is returned for the SQL statement.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ld12254341f8947f0ac25c448ea79fe52"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1174336112610">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ld3124693ef584e71a67e30fec75d9570"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b176541746185910">SQL_STILL_EXECUTING</strong> indicates that the statement is being executed.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p385393614018"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b10442613279">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a3a3a73b5c2b240e78064ffaac1ed6fd1">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b481194463715">SQLExecute</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b78215442376">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1828449373">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b08415443373">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b38520449378">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b6851944143717">SQL_HANDLE_STMT</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1586744163711">StatementHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b486044133717">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p585023613402"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b112995617011">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9cb43e95ef7e44fc8d5028d6132b1dee">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p164231125164013"></p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section115053113551"><h4 class="sectiontitle">SQLFetch</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p4428555145514"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b119677241103">Function</strong></p>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae74bd82077a84a00ae393f5a4e8964af"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b161271140334">SQLFetch</strong> advances the cursor to the next row of the result set and retrieves any bound columns.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p4973149175612"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1847017716346">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_s23ab3e91dd614677a77610d8074814b0"><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">SQLFetch</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>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p148341518125613"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1046318173416">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_tbd1fb67555bb459ca335b85396caf11a" frame="border" border="1" rules="all"><caption><b>Table 9 </b>SQLFetch parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r13cf2cab2abc43a9a975c226d75ebf79"><th align="left" class="cellrowborder" valign="top" width="23.119999999999997%" id="mcps1.3.64.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a745eb63c7cd843ecb7c5f461637387f9"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1626317373517">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="76.88000000000001%" id="mcps1.3.64.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9e81244385d04bff909ab3db943a603b"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1928713192358">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r73c7db2dd57d4a75a7b69dd0a62271d0"><td class="cellrowborder" valign="top" width="23.119999999999997%" headers="mcps1.3.64.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a7ecf78456569421db6a732fed73d6cc0">StatementHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.88000000000001%" headers="mcps1.3.64.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab34a95e1bde8499aa25f4aea0f6f4eb7">Statement handle, obtained from <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b88039481434">SQLAllocHandle</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1240428115615"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b14352111415216">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u2af1d9cd135641e5b3fff517a5afc930"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ld67b28f6f7bb4d4aa9af68363391eb3b"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b3884730122511">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lb9a516b9607d445c8be0c33c0a250ee9"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b4211181384820">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l0c20279e7c3c410daa0e45d2727dfd32"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b318862316261">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lb24525c38b964f6490c2f0c9e54cf7da"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1182712118318">SQL_NO_DATA</strong> indicates that no result set is returned for the SQL statement.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lf5226e78e9e9472aa7780ececd45f310"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1617553613266">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lc8bfaccb84534819b1962ecd6aebf6c8"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b17656114635919">SQL_STILL_EXECUTING</strong> indicates that the statement is being executed.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p13165183516567"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b20443117274">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a391efbc1295d4700bb76186b999d8d8b">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b093712542373">SQLFetch</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b9938254103716">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b89380548375">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b99401554123718">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b194115413714">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b194235414377">SQL_HANDLE_STMT</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b14943254163719">StatementHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1194485453718">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p5157194116564"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b15301656908">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a5684cc387cf94029a7652353c6a693d0">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section92881059105615"><h4 class="sectiontitle">SQLFreeStmt</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p34322045719">In ODBC 3.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i185410190718">x</em>, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b220214161178">SQLFreeStmt</strong> (a function in ODBC 2.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i76341332274">x</em>) was deprecated and replaced with <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1203116275">SQLFreeHandle</strong>. For details, see <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section86888253574">SQLFreeHandle</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section159669139573"><h4 class="sectiontitle">SQLFreeConnect</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1516314159574">In ODBC 3.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i4369845774">x</em>, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b70787561363756">SQLFreeConnect</strong> (a function in ODBC 2.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i143551058177">x</em>) was deprecated and replaced with <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b41031466663756">SQLFreeHandle</strong>. For details, see <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section86888253574">SQLFreeHandle</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section86888253574"><a name="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section86888253574"></a><a name="en-us_topic_0000001188163746_section86888253574"></a><h4 class="sectiontitle">SQLFreeHandle</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p122781637201311"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1096918241018">Function</strong></p>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a587143c92bb0458e9fa551932a13e92c"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b151171012889">SQLFreeHandle</strong> releases resources associated with a specific environment, connection, or statement handle. It replaces the ODBC 2.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i16741179818">x</em> functions: <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b81171012786">SQLFreeEnv</strong>, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1911710128818">SQLFreeConnect</strong>, and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1811711123820">SQLFreeStmt</strong>.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p116981943121318"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b54731675341">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_sef0d048fb2ec468e884f2278a50ca403"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">SQLRETURN</span><span class="w"> </span><span class="nf">SQLFreeHandle</span><span class="p">(</span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">HandleType</span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">SQLHANDLE</span><span class="w"> </span><span class="n">Handle</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p39954181312"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b548141813413">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_t03ba85442b1f4c1382a7b6075a17f7e4" frame="border" border="1" rules="all"><caption><b>Table 10 </b>SQLFreeHandle parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r56ac6a5f2ee54c46861d3ea4ddbd091e"><th align="left" class="cellrowborder" valign="top" width="29.69%" id="mcps1.3.78.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af751aff534ac4d589af14a0293009125"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b162641531356">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="70.30999999999999%" id="mcps1.3.78.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab99ccfaf467547de887e601984f733ca"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b16289181963519">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r8250ae48bd5f4e89ad11173fecb3e0b7"><td class="cellrowborder" valign="top" width="29.69%" headers="mcps1.3.78.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a62c2135a1db74bedbe15cc28b7ed37c9">HandleType</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.30999999999999%" headers="mcps1.3.78.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a09b9222f173845a5a2acf41c3a36713c">Type of handle to be freed by <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1671113210813">SQLFreeHandle</strong>. The value must be one of the following:</p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u1a8f02b4ac554b6291396e26d31017fc"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l79c24748d4034e2e87744e4f335b3eec">SQL_HANDLE_ENV</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l03c8b7a2aa3941898a497b45cf3e52b6">SQL_HANDLE_DBC</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l41e0464e645044698063d06064abd4f8">SQL_HANDLE_STMT</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l2a42b6a7e161494aace279ff0406119f">SQL_HANDLE_DESC</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aeb078121d5124803905e92532b677851">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b0449174312814">HandleType</strong> is not one of these values, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b4449043781">SQLFreeHandle</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1444914314814">SQL_INVALID_HANDLE</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r2efea4a87f844253855f89106fdf5e3a"><td class="cellrowborder" valign="top" width="29.69%" headers="mcps1.3.78.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a2fada07524814e5ab677fee0efc34940">Handle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.30999999999999%" headers="mcps1.3.78.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a37782ad683e14fe3965d244c78980c23">Handle to be released.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p7554142101412"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b153531014165212">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_en-us_topic_0059779231_ul81431234355"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_led97db5d2d384df0854bf28c18330340"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b288553014259">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l5d1761015cbd4193a0067d357fdc4a25"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1721212135488">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_la68b1dc5ddd5426f8f21bb73ced76f2e"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b719072312263">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_laccb0fe9035f4018a00e2465f39b6177"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b81771362267">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p64501611171413"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1944413116275">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a49f9da7ea7d44ebda83d386c29b51938">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b157698178863756">SQLFreeHandle</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b179792388263756">SQL_ERROR</strong>, the handle is still valid.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1709141871414"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b203210561706">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a056b4da9e0e6480cb46d12b2026caed7">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p17331924101417"></p>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section14668528111416"><h4 class="sectiontitle">SQLFreeEnv</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1429743021420">In ODBC 3.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i0901219299">x</em>, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b112823566763756">SQLFreeEnv</strong> (a function in ODBC 2.<em id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_i1242413715916">x</em>) was deprecated and replaced with <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b112420669363756">SQLFreeHandle</strong>. For details, see <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section86888253574">SQLFreeHandle</a>.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p14713340131414"></p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section39134140152"><h4 class="sectiontitle">SQLPrepare</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p11886143251510"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b169707246017">Function</strong></p>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab19e46ae56ae4199b9b558508da31548"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b98979571163756">SQLPrepare</strong> prepares an SQL statement to be executed.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p198661338121520"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b74755713347">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_s09cf0c86606b4237bdb5ded7c66d13a5"><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>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p13633135091514"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1449161813342">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_t70bfd814b1204f5fb827deb682a9f87e" frame="border" border="1" rules="all"><caption><b>Table 11 </b>SQLPrepare parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rbbc7fc9a493b49a7a37304b8a6872001"><th align="left" class="cellrowborder" valign="top" width="23.27%" id="mcps1.3.92.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a7e98a2d280e84400addff1c6f33cbb98"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b3265538359">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="76.73%" id="mcps1.3.92.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9c363b06ef0b474d8b8137de1bec1a88"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1129031915356">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rac2acf93c1ce4d32a0beff97502964ef"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.92.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a0761062f24c74892aa4d4c0580e5a4ba">StatementHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.92.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a7bea0d0eb0364910ae1f5999c147d38b">Statement handle.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r2849c9da5c8d48f489d47cddd9b1d508"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.92.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aae380049de7b4a299c5213dbd3a375fd">StatementText</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.92.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a6655c5d582ad46ae9becbee8aa85a365">SQL text string.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r00647b5f57b943bc90589622d562e71c"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.92.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a36de28fe23af49929f88457c74a9856d">TextLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.92.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a24805525c6d04bbf8a066b8691180762">Length of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b971414561798">StatementText</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1019215584154"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b16355514115214">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ud5067265c11846a38f0a788886d0ffbe"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_en-us_topic_0059779125_li42881082362"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b5886173016255">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l806dea684f734274af823f4b4e7a526c"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b5214111310481">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_laccea595492b4b1399457893c9cfcb58"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1519116236265">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l5a2a8a4bd9e04efab8451025e7bba252"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b121781436162619">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l50a589018ddb4ddc8a80836fd8692e5d"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1466117464593">SQL_STILL_EXECUTING</strong> indicates that the statement is being executed.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p12720156171619"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b2044618116275">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ad608e464b7724817961e77ce3ce7499f">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b11805711163813">SQLPrepare</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b18806711163814">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1280751133819">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b6808181115388">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b8808201153818">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b680971112385">SQL_HANDLE_STMT</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1781091133818">StatementHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b12810161111385">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p548261410167"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b153355611010">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae9f2397f1b54445eb214dcce42a92800">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section46391722141612"><h4 class="sectiontitle">SQLGetData</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1615011375160"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b497217241011">Function</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a170086c4c4334c2387e317e083b2b23c"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b15221624191110">SQLGetData</strong> retrieves data for a single column in the current row of the result set. It can be called multiple times to retrieve data of variable lengths.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p513843716160"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b147710703417">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_s81f54b4f886d4faa9444f4ec75fceabc"><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>
|
|
<span class="normal">4</span>
|
|
<span class="normal">5</span>
|
|
<span class="normal">6</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">SQLRETURN</span><span class="w"> </span><span class="nf">SQLGetData</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="n">SQLUSMALLINT</span><span class="w"> </span><span class="n">Col_or_Param_Num</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">TargetType</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLPOINTER</span><span class="w"> </span><span class="n">TargetValuePtr</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLLEN</span><span class="w"> </span><span class="n">BufferLength</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLLEN</span><span class="w"> </span><span class="o">*</span><span class="n">StrLen_or_IndPtr</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1412363761619"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b195141853418">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ta7fbb702aa584f5799284613d7bb357a" frame="border" border="1" rules="all"><caption><b>Table 12 </b>SQLGetData parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r1d60e3db033e4a76b7c7fdac31a1b77a"><th align="left" class="cellrowborder" valign="top" width="26.040000000000003%" id="mcps1.3.99.7.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a20f6105938ed40edb84bc8c6d465b506"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b142660323520">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="73.96000000000001%" id="mcps1.3.99.7.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a60daf837e1304a4fa9b59b3183ebaf3a"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b12927192358">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r3decdb7f1efc471f9f2e6cfd084b4eef"><td class="cellrowborder" valign="top" width="26.040000000000003%" headers="mcps1.3.99.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_acd13c8f7320d46fa80df75515bf1e201">StatementHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.96000000000001%" headers="mcps1.3.99.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a29cce607e5594c7a87118f67f0a4a038">Statement handle, obtained from <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b89351052930">SQLAllocHandle</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r3d31a8181b3942c5816520f8affc13ca"><td class="cellrowborder" valign="top" width="26.040000000000003%" headers="mcps1.3.99.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a1c7537f5da5440cf874e39c3da030b0d">Col_or_Param_Num</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.96000000000001%" headers="mcps1.3.99.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a139a8912deec4179beb635f67ea1fe07">Column number of the data to be returned. The columns in the result set are numbered from 1 in ascending order. The number of the bookmark column is 0.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rdba73feac072457d83c81f98f2a751a0"><td class="cellrowborder" valign="top" width="26.040000000000003%" headers="mcps1.3.99.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a49efc9edcc6d4af6a6b3a3ac3e680244">TargetType</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.96000000000001%" headers="mcps1.3.99.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae21c764d447747d4ad0019c6bf05920e">Type identifier of the C data type in the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b106641311121215">TargetValuePtr</strong> buffer. If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b19332917463756">TargetType</strong> is <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b25132266863756">SQL_ARD_TYPE</strong>, the driver uses the data type of the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b211788428463756">SQL_DESC_CONCISE_TYPE</strong> field in ARD. If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b187602637363756">TargetType</strong> is <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b23997424663756">SQL_C_DEFAULT</strong>, the driver selects a default data type according to the source SQL data type.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r8a8ba9c65f5c451cba717af2694d6b91"><td class="cellrowborder" valign="top" width="26.040000000000003%" headers="mcps1.3.99.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae2d959a471134e5781df4ed0e68ee059">TargetValuePtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.96000000000001%" headers="mcps1.3.99.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a965ed9d60efd4e0ba8c456c03a1cbd1e"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af537ce08bf324c0fb888d58b38b3b3a1">Output parameter</strong>: pointer to the pointer that points to the buffer where the data is located.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rc789a37be7ac42a0b1ccf556fa2d148e"><td class="cellrowborder" valign="top" width="26.040000000000003%" headers="mcps1.3.99.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a4357162e17e847b58364b417fbe8e9b4">BufferLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.96000000000001%" headers="mcps1.3.99.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_afc07fa8b7d55476eaf7a9c92b06d8c3c">Size of the buffer pointed to by <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b46795410063756">TargetValuePtr</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rd4ef73951a8b4e3581dc1e2c6c1b68d2"><td class="cellrowborder" valign="top" width="26.040000000000003%" headers="mcps1.3.99.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ad9e8dae0aeb24550a2d8349adc7314d0">StrLen_or_IndPtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.96000000000001%" headers="mcps1.3.99.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_acfa44d94fdc14e5f9078289193768568"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af059331341c64b6fa8dac101aa18ed68">Output parameter</strong>: pointer to the buffer where the length or identifier value is returned.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p442002812481"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b56455475">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u841ab2c3abbb477fa3135bf3a59b7af6"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l1201e2e0c0a448b180d4df4172b868e8"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b148888308256">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l398b29c64ee541f580151a4d2a41db51"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1421620137488">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l9f8d2fa7abd74fc7b9662e5882ecea2b"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1819272312613">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l0410f600593c44af8317b6e980e6db2f"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b17829610316">SQL_NO_DATA</strong> indicates that no result set is returned for the SQL statement.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_le024799b16144411af3354c10208f01d"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b3179183682615">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l7d13b94ff2fe4e5c94170d1cff4ac4e0"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b9663144655910">SQL_STILL_EXECUTING</strong> indicates that the statement is being executed.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p411313371164"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b17365101313">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a56f74d80331f4508b8ae98e20af8e19b">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b57157367385">SQLFetch</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1716113619388">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1571711364384">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1071983610383">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1772043616386">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1872115368384">SQL_HANDLE_STMT</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b167227366381">StatementHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b177225367383">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p2110103751612"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b79381042191416">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a2689b0ba9d6a47879d96a7538d762de6">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p18717112318169"></p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343"><a name="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343"></a><a name="en-us_topic_0000001188163746_section2084121410343"></a><h4 class="sectiontitle">SQLGetDiagRec</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p6282132820344"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1697313247019">Function</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af3b3dcc7f86d4a6a8e998fe77c239d69"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b92225587144">SQLGetDiagRec</strong> returns the current values of multiple fields of a diagnostic record that contains error, warning, and status information.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p326018283345"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b647907123415">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_s1aeb15f9a4514a9db133d8436498c113"><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>
|
|
<span class="normal">4</span>
|
|
<span class="normal">5</span>
|
|
<span class="normal">6</span>
|
|
<span class="normal">7</span>
|
|
<span class="normal">8</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">SQLRETURN</span><span class="w"> </span><span class="nf">SQLGetDiagRec</span><span class="p">(</span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">HandleType</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLHANDLE</span><span class="w"> </span><span class="n">Handle</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">RecNumber</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLCHAR</span><span class="w"> </span><span class="o">*</span><span class="n">SQLState</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLINTEGER</span><span class="w"> </span><span class="o">*</span><span class="n">NativeErrorPtr</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLCHAR</span><span class="w"> </span><span class="o">*</span><span class="n">MessageText</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="n">BufferLength</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">SQLSMALLINT</span><span class="w"> </span><span class="o">*</span><span class="n">TextLengthPtr</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p10230162814346"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b14521318113417">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_tcb7cd4c68ed94b0c9d937312b18cc2ce" frame="border" border="1" rules="all"><caption><b>Table 13 </b>SQLGetDiagRec parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r18b89b6cb9fd41c4b8b6a0e1cd86c44b"><th align="left" class="cellrowborder" valign="top" width="19.12%" id="mcps1.3.100.7.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aa975f96fde2645fa896f24791bbdd15d"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b10267113153514">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="80.88%" id="mcps1.3.100.7.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aea55a00a69724b7d8fed5796300ae5b8"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1029331933515">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r21f21699e66b440e8e38c5c932b3c952"><td class="cellrowborder" valign="top" width="19.12%" headers="mcps1.3.100.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a50d02d75e36d45d9997c3883eb587edc">HandleType</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80.88%" headers="mcps1.3.100.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a426571676d3a45b3afd6eae568aef390">Handle type identifier that describes the handle type required for diagnosis. The value must be one of the following:</p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u4d3839c3349642c6a1ccc4e0e9f3cc09"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_la79c4672e569433cbd2f37ab8ce40826">SQL_HANDLE_ENV</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l1e885d7dd7e8422c96b034bf50f2f19e">SQL_HANDLE_DBC</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lfe6b08ec03884c4887f741abba96053b">SQL_HANDLE_STMT</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l383a7667aac34d84a0c3df16211130ee">SQL_HANDLE_DESC</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r752f8b6d005d4bed8913f0ff61fc113b"><td class="cellrowborder" valign="top" width="19.12%" headers="mcps1.3.100.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9f7ec27961a64859baec042d16596b1f">Handle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80.88%" headers="mcps1.3.100.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae059b7bc1ca14197a6d05b5658455b01">Handle of the diagnosis data structure. Its type is indicated by HandleType. If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b186607333163756">HandleType</strong> is <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b198546207763756">SQL_HANDLE_ENV</strong>, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b205600745263756">Handle</strong> may be shared or non-shared environment handle.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r8dd9832ff96f4638a2e5d52d98704542"><td class="cellrowborder" valign="top" width="19.12%" headers="mcps1.3.100.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a443d26ce4beb405e9d684970094d854c">RecNumber</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80.88%" headers="mcps1.3.100.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a3a1ad57c65c048b2a8e1275e17308277">Status record from which the application seeks information. Status records are numbered from 1.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r1acef274f1b34d1f822b5fbdf585c602"><td class="cellrowborder" valign="top" width="19.12%" headers="mcps1.3.100.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a20154d4aad8c467fa9e73e9299e74d8c">SQLState</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80.88%" headers="mcps1.3.100.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a4d1eb7e081ec4d9ab56072e0f8a85e9b"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b11750970763756">Output parameter</strong>: pointer to a buffer that saves the 5-character <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b115333038663756">SQLSTATE</strong> code pertaining to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b114679188963756">RecNumber</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r1d4d56dc08fb409491bd6b2e1b2b7972"><td class="cellrowborder" valign="top" width="19.12%" headers="mcps1.3.100.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aac8a93a7252249db856e5d2796c8510c">NativeErrorPtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80.88%" headers="mcps1.3.100.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a86dc5d1a45564f7ab266abcb8c1a3c8f"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af54255f0682b4a8a8b77a2a75bb048ae">Output parameter</strong>: pointer to a buffer that saves the native error code.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r28386bc6c73e480583f73f9b93dd5bd3"><td class="cellrowborder" valign="top" width="19.12%" headers="mcps1.3.100.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a19e254f118e540a8bdfc5cba3b4c5b7a">MessageText</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80.88%" headers="mcps1.3.100.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_adcef0f89b6cd4fccba5dd14382c779c1">Pointer to a buffer that saves text strings of diagnostic information.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r55799d0ecaf845b2af1cd24660529bf4"><td class="cellrowborder" valign="top" width="19.12%" headers="mcps1.3.100.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a3e07762a1479491794ab19cf013938ba">BufferLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80.88%" headers="mcps1.3.100.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a3d391871bcc1406aa9bfe7fd243d9489">Length of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1429011351177">MessageText</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r57f384242f16402e976f6ac395fdc866"><td class="cellrowborder" valign="top" width="19.12%" headers="mcps1.3.100.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a04711737a07944098fa5e3ea775629bb">TextLengthPtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="80.88%" headers="mcps1.3.100.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a0c8f74464d5e44839a0cb181d7bae105"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b64284819363756">Output parameter</strong>: pointer to the buffer, the total number of bytes in the returned <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b140850608463756">MessageText</strong>. If the number of bytes available to return is greater than <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b116960901263756">BufferLength</strong>, then the diagnostics information text in <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b139148378163756">MessageText</strong> is truncated to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b195049892463756">BufferLength</strong> minus the length of the null termination character.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p921692820343"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b123565144525">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u3343a6eabd7b4a839b3e144299f528d1"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_le3c943e7704249f7a69fe10f1101ea5c"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1888993002518">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l675a18d9a634492b9177f3373b8362dd"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b102171613194814">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l47586ad549ba48d89258d803525c33c9"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b19193523162614">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ldbbaee9335544a78a231a182063c4d21"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b101801536142611">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p21961928123414"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b14448815274">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a5823f5735b4147ffbecad101ed126487"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b62066302863756">SQLGetDiagRec</strong> does not release diagnostic records for itself. It uses the following returned values to report execution results:</p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ua89a4985507449d48b2aad0d35a4be1a"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l1cfd6e594274430e9bc846cca0ee66c6"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b5397005663756">SQL_SUCCESS</strong>: The function successfully returns diagnostic information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lff40313241344227a9d8910a5e9cd6c0"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b187272098263756">SQL_SUCCESS_WITH_INFO</strong>: The <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b104006111263756">*MessageText</strong> buffer is too small to hold the requested diagnostic message and no diagnostic records are generated.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l9e503f1f6ca7452ab4083be3f4dee882">SQL_INVALID_HANDLE: The handle specified by <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b7108171041918">HandType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b96417149194">Handle</strong> is invalid.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l27e4989b64504724bcdcd72c0d8db8f4"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b842352706153635">SQL_ERROR</strong>: <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b842352706153638">RecNumber</strong> is smaller than or equal to zero, or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b842352706153640">BufferLength</strong> is smaller than zero.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a29ace0ab5ac042bc8eab0e6910d6e94f">If an ODBC function returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b356623115196">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b6566631131916">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b12567103181919">SQLGetDiagRec</strong> and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b756713310199">SQLSTATE</strong> value. The possible <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b175678314191">SQLSTATE</strong> values are listed as follows:</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_tf4e3234899204a508884197715ec6f7a" frame="border" border="1" rules="all"><caption><b>Table 14 </b>SQLSTATE values</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r51827b61048d4de0b22030d438f15abc"><th align="left" class="cellrowborder" valign="top" width="20.352035203520348%" id="mcps1.3.100.14.2.4.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab68283e0c14c43c5bdd4eb7a99f0189a">SQLSATATE</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="31.983198319831978%" id="mcps1.3.100.14.2.4.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ac61882d7b8a44fd1b417584174df07d2"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b834135211190">Error</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="47.66476647664767%" id="mcps1.3.100.14.2.4.1.3"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a295f879b90ba440388fe6a03be4de157"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1340535312197">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_reab14c65bb19422f9783fb8d0fec53a8"><td class="cellrowborder" valign="top" width="20.352035203520348%" headers="mcps1.3.100.14.2.4.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a4a19be0f418d41b692f674eb3ad603e1">HY000</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.983198319831978%" headers="mcps1.3.100.14.2.4.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae7b5620fcdff429682614b2d96facd88">General error</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="47.66476647664767%" headers="mcps1.3.100.14.2.4.1.3 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9e6d5f6f4949497dbb352cb5a79d1bac">An error occurred for which there is no specific <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b198231520209">SQLSTATE</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r796344138f6d408ebf861cf9516ae842"><td class="cellrowborder" valign="top" width="20.352035203520348%" headers="mcps1.3.100.14.2.4.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a5fd1803a4d4f48738c38f759f3a54871">HY001</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.983198319831978%" headers="mcps1.3.100.14.2.4.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a10da18fc33374037acab38166b33fea1">Memory allocation error</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="47.66476647664767%" headers="mcps1.3.100.14.2.4.1.3 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a022276c89a5c4b6799fac09f678907cc">The driver is unable to allocate memory required to support execution or completion of the function.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r02bc3dd34a0147afbc283f4a7fdc3fb3"><td class="cellrowborder" valign="top" width="20.352035203520348%" headers="mcps1.3.100.14.2.4.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a5446c887831e43cd85283ca0060653e2">HY008</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.983198319831978%" headers="mcps1.3.100.14.2.4.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab4225d49f2eb489f950bc8775bbff09b">Operation canceled</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="47.66476647664767%" headers="mcps1.3.100.14.2.4.1.3 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9688d4e4abbc4cd08b96eabceab7660a"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b20385937162018">SQLCancel</strong> is called to terminate the statement execution, but the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b398215456204">StatementHandle</strong> function is still called.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r87549de543d54218a120178ca4dfaee8"><td class="cellrowborder" valign="top" width="20.352035203520348%" headers="mcps1.3.100.14.2.4.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af8edf70c46314b7fa1d9d3cdd4efd0a3">HY010</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.983198319831978%" headers="mcps1.3.100.14.2.4.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aa8a826c3cdc5410bafa0c2ad9859a75b">Function sequence error</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="47.66476647664767%" headers="mcps1.3.100.14.2.4.1.3 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ac2f08089b46c4a539483ff178a40c230">The function is called prior to sending data to data parameters or columns being executed.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rd4fd8916c0a74c1d8d2f9937d9ce0061"><td class="cellrowborder" valign="top" width="20.352035203520348%" headers="mcps1.3.100.14.2.4.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a67ce4bead49c45b6979a6760558caf98">HY013</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.983198319831978%" headers="mcps1.3.100.14.2.4.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af9c976234aa4413db89a580d51680538">Memory management error</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="47.66476647664767%" headers="mcps1.3.100.14.2.4.1.3 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae70b7febe6404e43baaa326ea44b83f2">The function fails to be called. The error may be caused by low memory conditions.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r81a7c90e84e443b6a1f25ef1b24b2203"><td class="cellrowborder" valign="top" width="20.352035203520348%" headers="mcps1.3.100.14.2.4.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a20f8ca67670543df91b5ccab194377f9">HYT01</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.983198319831978%" headers="mcps1.3.100.14.2.4.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab85548b8609a4458b937c2b86507c580">Connection timeout</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="47.66476647664767%" headers="mcps1.3.100.14.2.4.1.3 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a492e13ffca9143248980ede7623a0ecb">The connection times out before the data source responds to the request.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r6321329ee2314fe892e1248b13da03b1"><td class="cellrowborder" valign="top" width="20.352035203520348%" headers="mcps1.3.100.14.2.4.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9861b7cff4504413abf93f9552b4536c">IM001</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.983198319831978%" headers="mcps1.3.100.14.2.4.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a47c534b7357e4ece93bb3563abfa9f01">Function not supported by the driver</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="47.66476647664767%" headers="mcps1.3.100.14.2.4.1.3 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a81eeec753a314c8eaf003a34ec608b2f">A function that is not supported by the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1119001711228">StatementHandle</strong> driver is called.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1519332812341"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1534165618010">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ad51b80ad1bf54e509e3d718e2f48a3e1">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p17330121573415"></p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section6751154743518"><h4 class="sectiontitle">SQLSetConnectAttr</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p520831153619"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b29759242007">Function</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a00d515d22a2d4defb5fd86a7ed4260ab"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b17389203513224">SQLSetConnectAttr</strong> sets connection attributes.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p161981317361"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b194801779345">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_s4d435bac28684364a5f0167ec8917305"><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>
|
|
<span class="normal">4</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">SQLRETURN</span><span class="w"> </span><span class="nf">SQLSetConnectAttr</span><span class="p">(</span><span class="n">SQLHDBC</span><span class="w"> </span><span class="n">ConnectionHandle</span>
|
|
<span class="w"> </span><span class="n">SQLINTEGER</span><span class="w"> </span><span class="n">Attribute</span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">SQLPOINTER</span><span class="w"> </span><span class="n">ValuePtr</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">StringLength</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p20186313361"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1554121863415">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_t11fb2c255dab421fb16e17cb925b2b55" frame="border" border="1" rules="all"><caption><b>Table 15 </b>SQLSetConnectAttr parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_re8aa7b22e8c441ada93f8e9e3908c1e3"><th align="left" class="cellrowborder" valign="top" width="23.27%" id="mcps1.3.101.7.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae72c71f100dc4de7a8e31b64f4084fa1"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b726873133520">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="76.73%" id="mcps1.3.101.7.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aaa347293417848ee89ad9cbe9faea0c7"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b20295181920356">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r0aa1478fbbc04ea59ec9b2da21aaec46"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.101.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a257335baea484faab740eaef78849436">StatementtHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.101.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab8a9f9f0f23f45ab819ab839823f5f60">Connection handle.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_re5c1b86bf66a4baa83484ea63c0d321a"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.101.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a069956ecba4d49dbae41911182461fbb">Attribute</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.101.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a3960fc4c48764525b18b7ad4e4f7f8b2">Attribute to set.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rd2c8b8a3fbf54a41b23e0def447e520f"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.101.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a265b9cb9325e4390975623ab0d9d9c87">ValuePtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.101.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aa4ee369078da4b7491648ffc302d8761">Pointer to the value of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1773842192310">Attribute</strong>. <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b288021412317">ValuePtr</strong> depends on the value of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b4886122414231">Attribute</strong> and can be a 32-bit unsigned integer value or a null-terminated string. If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b77602082413">ValuePtr</strong> parameter is driver-specific value, it may be signed integer.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r1a97f12422c14d6fa2203ead98d1eb4b"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.101.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a922bb6eb5b2546a4a28cf10a9dc3cd1c">StringLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.101.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a90ea9e544e8f4c8fb4ee335c9332d763">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b172000827363756">ValuePtr</strong> points to a string or a binary buffer, this parameter should be the length of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b93481857963756">*ValuePtr</strong>. If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b10259956863756">ValuePtr</strong> points to an integer, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b126445274763756">StringLength</strong> is ignored.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1118131143615"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b935814148529">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u27ada21a16c94a7b92a73c59f0da02d2"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lfc796bf0c5ab4f28b347ccea8af9683c"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1589073010259">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l5f48d0fb12524a099bd045767e214807"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b12219101354811">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l8d8d0a9e237d4914bb5caf82813b2090"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1019418238267">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l9fc0f9a55105448689e04ccd1034c00c"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b0181103632613">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p11773114363"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b5449218278">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ad3db1af5456f4278b784d2ccc5bb93a0">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1950017544381">SQLSetConnectAttr</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b13501115453815">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b85026542385">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b75051554173810">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b8506205413389">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b75076542387">SQL_HANDLE_DBC</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b0508185463816">ConnectionHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b95099547385">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p21742116360"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1636356100">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a26127f42db3b47599384746a5cb6749e">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section1430920178367"><h4 class="sectiontitle">SQLSetEnvAttr</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p159751631123613"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b39774241107">Function</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a99a2a559c5274fc3abb08ebe3dbd1839"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b134349106863756">SQLSetEnvAttr</strong> sets environment attributes.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p2096593113365"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b9481973342">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_sb5d7e1282122430f8d896641547a3028"><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>
|
|
<span class="normal">4</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">SQLRETURN</span><span class="w"> </span><span class="nf">SQLSetEnvAttr</span><span class="p">(</span><span class="n">SQLHENV</span><span class="w"> </span><span class="n">EnvironmentHandle</span>
|
|
<span class="w"> </span><span class="n">SQLINTEGER</span><span class="w"> </span><span class="n">Attribute</span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">SQLPOINTER</span><span class="w"> </span><span class="n">ValuePtr</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">StringLength</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1095013317367"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b14559187347">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_tda240979de2648c88f18ab7eb797c1ed" frame="border" border="1" rules="all"><caption><b>Table 16 </b>SQLSetEnvAttr parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r12c2548ca0b04d1294f892b8b394f552"><th align="left" class="cellrowborder" valign="top" width="23.27%" id="mcps1.3.102.7.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9718cb44b84243e2957a6047535cc855"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b926914373518">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="76.73%" id="mcps1.3.102.7.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a024734e9eefc45a3b3d2f8d3f30df709"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b19296111973517">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r24ff7e2ae8be4cafb409795fe72e47ec"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.102.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aaee847518a784a08958d60eea5659de3">EnvironmentHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.102.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a3fcc368b67204e8e8ed626fe84ac60eb">Environment handle.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r218121e2fecc471d8bfea777f3affc26"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.102.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aa20a8601617d45c8b10a5a0814b26c66">Attribute</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.102.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a8aa8dd39b55a4e409d8540e6471cfb39">Environment attribute to be set. Its value must be one of the following:</p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ucff25d4eb2224e808af7dfecf730778a"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lbb0482deca5e4c7592bdec666e79543d"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b43209008263756">SQL_ATTR_ODBC_VERSION</strong>: ODBC version</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l8e2e973b9a3c4fad910f4aa7b432cb1b"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b86634679563756">SQL_CONNECTION_POOLING</strong>: connection pool attribute</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l0666dc5fb4e94fd5adabc86f01a1dcca"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b162688164663756">SQL_OUTPUT_NTS</strong>: string type returned by the driver</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r31958dbf8a704b32a4623fc12a6d0f2d"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.102.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a5672b65be7584744afb58cff79b3f54d">ValuePtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.102.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a76970c185e0d4dc9b237190320b81b06">Pointer to the value of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b78711750102518">Attribute</strong>. <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b116303769463756">ValuePtr</strong> depends on the value of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1335114815263">Attribute</strong> and can be a 32-bit integer value or a null-terminated string.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r0e4f89c7077b4b9eb68a2a9ca52de159"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.102.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_acf45c224ec2e4f6f83050592e7d082da">StringLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.102.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_adb732140ce374a4289b741abe5cd6a85">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b16205111192710">ValuePtr</strong> points to a string or a binary buffer, this parameter should be the length of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b10205141132719">*ValuePtr</strong>. If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b15205611276">ValuePtr</strong> points to an integer, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b9205121122713">StringLength</strong> is ignored.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p394573120367"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b336016142522">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u0801de3490ea4ada94639c369d34f02c"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l8255166e15e546c09253ada99c83d8d4"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b2891123012256">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_en-us_topic_0059778852_li84669152393"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1222191314482">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l60ae9540f5614a8d9d751214c4c425c8"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1119572392614">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_la73f3363c8664841aa8b19d0e446cf93"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1182123614262">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p994216315367"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b7451151162716">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a63f8e42e229b4dec8c245b62ce383f3e">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b650582714">SQLSetEnvAttr</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b3515542717">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b250519273">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1511515279">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b135195162713">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b20685152717">SQL_HANDLE_ENV</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b4613542710">EnvironmentHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b667512710">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p17939183123618"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b63710565010">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a6af66b4d5a3546aaa419c8c37e081a71">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section14589135243610"><h4 class="sectiontitle">SQLSetStmtAttr</h4><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p2664413719"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b63431526135017">Function</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a9b7c4452ba894a64a9ed57e067442910"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b163794448563756">SQLSetStmtAttr</strong> sets attributes related to a statement.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p75719410377"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b10486973344">Prototype</strong></p>
|
|
<div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_s492ae4f2f00a43f6af5688ee94cb6346"><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>
|
|
<span class="normal">4</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">SQLRETURN</span><span class="w"> </span><span class="nf">SQLSetStmtAttr</span><span class="p">(</span><span class="n">SQLHSTMT</span><span class="w"> </span><span class="n">StatementHandle</span>
|
|
<span class="w"> </span><span class="n">SQLINTEGER</span><span class="w"> </span><span class="n">Attribute</span><span class="p">,</span><span class="w"> </span>
|
|
<span class="w"> </span><span class="n">SQLPOINTER</span><span class="w"> </span><span class="n">ValuePtr</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">StringLength</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p24710419372"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b115671883411">Parameters</strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_t42ef93b9268d4766a00aa056c7cfee2a" frame="border" border="1" rules="all"><caption><b>Table 17 </b>SQLSetStmtAttr parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r469170e47f1c4365bb915ceeb477506b"><th align="left" class="cellrowborder" valign="top" width="23.27%" id="mcps1.3.103.7.2.3.1.1"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ae0e7a7fd2152408a833d57b27bb1d04d"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b72702323515">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="76.73%" id="mcps1.3.103.7.2.3.1.2"><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a0f904fe9fc804a3b91cb27ddb54ea3b8"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b92984194358">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r2304ae81aa564fdda86e48fd1e867a0b"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.103.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a039c45bf9d6f4de4abe4e108ffbd298c">StatementtHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.103.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a41f0593bd1da449382909d77b45ab2f2">Statement handle.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_rb6377637b25c4964a3faf3e37627b3c0"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.103.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a701c70e8c0e84dd88d387c17a6c78a0f">Attribute</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.103.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a4297bdfc934d4baebac3bff37b6035ab">Attribute to set.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r31bc02a648db44838a5d6f8fe6347e1c"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.103.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aaa782b86b59b451ebdf6762dc809353c">ValuePtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.103.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ac618d0fd0f714afdadf8af8593791df4">Pointer to the value of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b178884273275">Attribute</strong>. <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b181726809563756">ValuePtr</strong> depends on the value of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b10855133912718">Attribute</strong> and can be a 32-bit unsigned integer value or a pointer to a null-terminated string, a binary buffer, and a driver-specified value. If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b5759618288">ValuePtr</strong> parameter is driver-specific value, it may be signed integer.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_r0e342b1bdb274886be7ba5eeeb257af1"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.103.7.2.3.1.1 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_aa4096f3c5d6c4016827551b0bcce3bce">StringLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.103.7.2.3.1.2 "><p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_ab875ee993fd94b039bb50bfee9a21c19">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1276458102820">ValuePtr</strong> points to a string or a binary buffer, this parameter should be the length of <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1576419862816">*ValuePtr</strong>. If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b137646842811">ValuePtr</strong> points to an integer, <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b37646832817">StringLength</strong> is ignored.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p204214418375"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b201781301263">Return values</strong></p>
|
|
<ul id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_u5cbdc73afd05465281ac1ac033d5b0a7"><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l88ebf722d60f42dfbbb911cd33e2767a"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b6892113072519">SQL_SUCCESS</strong> indicates that the call is successful.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_lc6e1a84c7e4348639cd56464ae5b9694"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b8223121316481">SQL_SUCCESS_WITH_INFO</strong> indicates warning information.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l3627f31b034b4fc99b81f6babe2be662"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b619732316269">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection setup failures.</li><li id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_l7fee2e4f2ba842aa966a44ccdcc59140"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b918473619263">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the values returned by the API you have used.</li></ul>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p1839164133717"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b34531214272">Precautions</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_a5448b01c753d44a5b47ae4c95627126f">If <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b93171612102816">SQLSetStmtAttr</strong> returns <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1831715129281">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b3317151219286">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="#EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_section2084121410343">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b1318912202814">HandleType</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b4318412112819">Handle</strong> to <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b131811123283">SQL_HANDLE_STMT</strong> and <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b103186129282">StatementHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b831811212811">SQLSTATE</strong> value. This value can be used to get more information about the function call.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p2369473717"><strong id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_b25601234122711">Examples</strong></p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_af5950e84ad4e4e0daaf6b999ebb7a07e">See <a href="dws_04_0123.html">ODBC Development Example</a>.</p>
|
|
<p id="EN-US_TOPIC_0000002044151968__en-us_topic_0000001188163746_p3911145333615"></p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0117.html">ODBC-Based Development</a></div>
|
|
</div>
|
|
</div>
|
|
|