forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
62 lines
7.8 KiB
HTML
62 lines
7.8 KiB
HTML
<a name="EN-US_TOPIC_0000001233761791"></a><a name="EN-US_TOPIC_0000001233761791"></a>
|
|
|
|
<h1 class="topictitle1">SQLSetEnvAttr</h1>
|
|
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001233761791__sc3e8a910032f42cebe6ebf6be97ab934"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001233761791__ad36ac19bd96446709e2a691979254eaf"><strong id="EN-US_TOPIC_0000001233761791__b842352706154935">SQLSetEnvAttr</strong> sets environment attributes.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233761791__s77df85ae6d3745b8958f50a6f075f560"><h4 class="sectiontitle">Prototype</h4><div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000001233761791__sc88f526627ac4a85801ceb3f1f5085f1"><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>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233761791__s9998a8d0b6a843eca89dc70f414c3dba"><h4 class="sectiontitle">Parameters</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001233761791__t84fcbc924f544329b8d0376618a9d944" frame="border" border="1" rules="all"><caption><b>Table 1 </b>SQLSetEnvAttr parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001233761791__r06a0d6dd41be428d9ed49305a17d5f9b"><th align="left" class="cellrowborder" valign="top" width="23.27%" id="mcps1.3.3.2.2.3.1.1"><p id="EN-US_TOPIC_0000001233761791__a10eed5527fa64d6492c860da1e39eac9">Keyword</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="76.73%" id="mcps1.3.3.2.2.3.1.2"><p id="EN-US_TOPIC_0000001233761791__abd75573d53b644df89261358877f642d">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001233761791__rb2ce5791067a4661bcfdf8cbf94aeb07"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001233761791__a5317f41ac8d94b848f17716a56eaf99d">EnviromentHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001233761791__ac3cba99d7b0443c4bfa89eea445a8ab7">Environment handle.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233761791__r215a7a74544a4d879e94a0406130fcd6"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001233761791__a5744d940c01e4374ae317506791c01f5">Attribute</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001233761791__af7bf0ddf4ce64ab28d93eb6e5c42e478">Environment attribute to be set. Its value must be one of the following:</p>
|
|
<ul id="EN-US_TOPIC_0000001233761791__u6ca625dc1ab44d0bab4be1e1b0db0c6c"><li id="EN-US_TOPIC_0000001233761791__l9f3c2c4d3e794bffa4a480d4ae7a4472"><strong id="EN-US_TOPIC_0000001233761791__b842352706155147">SQL_ATTR_ODBC_VERSION</strong>: ODBC version</li><li id="EN-US_TOPIC_0000001233761791__lf08bf550531c479fbe3a8717ef54a8bd"><strong id="EN-US_TOPIC_0000001233761791__b842352706155150">SQL_CONNECTION_POOLING</strong>: connection pool attribute</li><li id="EN-US_TOPIC_0000001233761791__lb4ff65c1d65f45c7b1a154d84e901933"><strong id="EN-US_TOPIC_0000001233761791__b842352706155155">SQL_OUTPUT_NTS</strong>: string type returned by the driver</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233761791__rd8b590963093410bb3a8c489ca7817a6"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001233761791__a80bcdd7e55e64bb99b53a8bd9e584b43">ValuePtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001233761791__accc8e93b364b4cc29d3b5ee5610c1ee0">Pointer to the Attribute value. <strong id="EN-US_TOPIC_0000001233761791__b842352706155133">ValuePtr</strong> depends on the Attribute value, and can be a 32-bit integer value or a null-terminated string.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233761791__rb74d1e64650e45bc9c88ba8a86ee086a"><td class="cellrowborder" valign="top" width="23.27%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001233761791__ab8d9396537a84df7a4a999d9fc0bc2ed">StringLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.73%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001233761791__adce789decf0c40969c8db9a7c13179b5">If <strong id="EN-US_TOPIC_0000001233761791__b84235270615534">ValuePtr</strong> points to a string or a binary buffer, this parameter should be the length of <strong id="EN-US_TOPIC_0000001233761791__b84235270615538">*ValuePtr</strong>. If <strong id="EN-US_TOPIC_0000001233761791__b842352706155312">ValuePtr</strong> points to an integer, <strong id="EN-US_TOPIC_0000001233761791__b842352706155314">StringLength</strong> is ignored.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233761791__s115fdbd336f14dc090785f26398b2de0"><h4 class="sectiontitle">Return Values</h4><ul id="EN-US_TOPIC_0000001233761791__u7023e41011d54a6ebef1ff963cc9b4e0"><li id="EN-US_TOPIC_0000001233761791__lb4af1a4d987547b6bc2168f9e688f56f"><strong id="EN-US_TOPIC_0000001233761791__b842352706112950">SQL_SUCCESS</strong> indicates that the call succeeded.</li><li id="EN-US_TOPIC_0000001233761791__en-us_topic_0059778852_li84669152393"><strong id="EN-US_TOPIC_0000001233761791__b842352706112952">SQL_SUCCESS_WITH_INFO</strong> indicates some warning information is displayed.</li><li id="EN-US_TOPIC_0000001233761791__l1b121747b97b423ba9c6bf216a59cd61"><strong id="EN-US_TOPIC_0000001233761791__b842352706112954">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection failures.</li><li id="EN-US_TOPIC_0000001233761791__la4112632f57a479ba4b07887fe2a8738"><strong id="EN-US_TOPIC_0000001233761791__b842352706112956">SQL_INVALID_HANDLE</strong> indicates that invalid handles were called. Values returned by other APIs are similar to the preceding values.</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233761791__sd0867623d74b42cabd88b744694045f2"><h4 class="sectiontitle">Precautions</h4><p id="EN-US_TOPIC_0000001233761791__a83fdaf10908a4c9e88122ef33fc3dde9">If <strong>SQLSetEnvAttr</strong> returns <strong>SQL_ERROR</strong> or <strong>SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="dws_04_0143.html">SQLGetDiagRec</a>, set <strong>HandleType</strong> and <strong>Handle</strong> to <strong>SQL_HANDLE_ENV</strong> and <strong>EnvironmentHandle</strong>, and obtain the <strong>SQLSTATE</strong> value. The <strong>SQLSTATE</strong> value provides the detailed function calling information.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233761791__s91197db88b9c4159a27d3001c6a872a9"><h4 class="sectiontitle">Examples</h4><p id="EN-US_TOPIC_0000001233761791__a45377b26dc2e42c9a18c49fb5b29e83f">See <a href="dws_04_0123.html">Examples</a>.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0124.html">ODBC Interfaces</a></div>
|
|
</div>
|
|
</div>
|
|
|