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>
82 lines
11 KiB
HTML
82 lines
11 KiB
HTML
<a name="EN-US_TOPIC_0000001233681833"></a><a name="EN-US_TOPIC_0000001233681833"></a>
|
|
|
|
<h1 class="topictitle1">SQLColAttribute</h1>
|
|
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001233681833__se896b2e6c9d94868acc3c7071a301553"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001233681833__a2b2f185f7e08443bb711265678502c3d"><strong id="EN-US_TOPIC_0000001233681833__b842352706102711">SQLColAttribute</strong> returns the descriptor information about a column in the result set.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233681833__sdeb274a616674ee6801810c3c9b38ddb"><h4 class="sectiontitle">Prototype</h4><div class="codecoloring" codetype="Cpp" id="EN-US_TOPIC_0000001233681833__s6d087579358c4846a03ff876f0bfd9b9"><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>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233681833__sf83a85e024a94eda86a82eb493436756"><h4 class="sectiontitle">Parameter</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001233681833__t48343475ebe74534a39f5b12e7c5251d" frame="border" border="1" rules="all"><caption><b>Table 1 </b>SQLColAttribute parameter</caption><thead align="left"><tr id="EN-US_TOPIC_0000001233681833__r5a8d7507cd1d4868863a803d01ec3425"><th align="left" class="cellrowborder" valign="top" width="26.86%" id="mcps1.3.3.2.2.3.1.1"><p id="EN-US_TOPIC_0000001233681833__a8baaf4ed48d94f61a35e0e338faef4c4">Keyword</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="73.14%" id="mcps1.3.3.2.2.3.1.2"><p id="EN-US_TOPIC_0000001233681833__a3f7e3a106348463a9e3d081b64cb929c">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001233681833__r9332310f823f4ced9c04591d9f21ff0d"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001233681833__a193c5d5d406f466d81e5b94f7d985529">StatementHandle</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001233681833__a166a13dc953943e8bac2abf571d35b40">Statement handle.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233681833__r9e18415d17624c5d8e32ae96676444b2"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001233681833__a8e21ac67449946658937fb3195e03f25">ColumnNumber</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001233681833__a1a5bba099943437fa3b7a720151d88f0">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_0000001233681833__re0ea22378e844c74842913998679913b"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001233681833__a0bef28b07ad04092b2d8b853a5d1b2c0">FieldIdentifier</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001233681833__a6b1af89161434480b93e6e54ff20562b">Field identifier of <strong id="EN-US_TOPIC_0000001233681833__b842352706103046">ColumnNumber</strong> in IRD.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233681833__r1d4efddd25f94b26b7612e2113cbfe10"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001233681833__ad4d3a4ad0c444e2187c881815f0c1204">CharacterAttributePtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001233681833__a6475fbb73f3646ef83f16253131f7814"><strong id="EN-US_TOPIC_0000001233681833__b842352706103056">Output parameter</strong>: pointer to the buffer that returns FieldIdentifier field value.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233681833__r8610068c4ab94bb7a3b23d6a4323a9e3"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001233681833__a8c081e43b9e74e989e8d9ee328e408fa">BufferLength</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.3.2.2.3.1.2 "><ul id="EN-US_TOPIC_0000001233681833__u65b579e1fe634d65bdfbe857b08eca1a"><li id="EN-US_TOPIC_0000001233681833__lafb755d53af348d0ae41b5f3afcafebb"><strong>FieldIdentifier</strong> indicates the length of the buffer if <strong id="EN-US_TOPIC_0000001233681833__b15610515161052">FieldIdentifier</strong> is an ODBC-defined field and <strong id="EN-US_TOPIC_0000001233681833__b35621975161046">CharacterAttributePtr</strong> points to a character string or a binary buffer.</li><li id="EN-US_TOPIC_0000001233681833__l3f4d4209d5dd48499b28b44a063806fd">Ignore this parameter if <strong id="EN-US_TOPIC_0000001233681833__b842352706103135">FieldIdentifier</strong> is an ODBC-defined field and <strong id="EN-US_TOPIC_0000001233681833__b842352706103140">CharacterAttributePtr</strong> points to an integer.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233681833__rb72baaefaeb54b96b8e0957b1807cca2"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001233681833__aa4858654fd4545f4898320b96c7129ee">StringLengthPtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001233681833__acd7d4d42097c4bec844fbbbb8f455c32"><strong id="EN-US_TOPIC_0000001233681833__b21610429182">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_0000001233681833__b11289021161124">*CharacterAttributePtr</strong>. Ignore the value of <strong id="EN-US_TOPIC_0000001233681833__b2198056161134">BufferLength</strong> if the data is not a string.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233681833__r98bb43c79cbe42fb9b3587b45da1917f"><td class="cellrowborder" valign="top" width="26.86%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001233681833__acfe27370dfce48838e1f061410653e83">NumericAttributePtr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="73.14%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001233681833__ad4144d5ca84c4a16bfb768702840180a"><strong id="EN-US_TOPIC_0000001233681833__b328311539182">Output parameter</strong>: pointer to an integer buffer in which the value of the <strong id="EN-US_TOPIC_0000001233681833__b38242333161144">FieldIdentifier</strong> field in the <strong id="EN-US_TOPIC_0000001233681833__b62683053161159">ColumnNumber</strong> row of the IRD is returned.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233681833__s38d87166ba05456f9ca82e5dc678aaea"><h4 class="sectiontitle">Return Values</h4><ul id="EN-US_TOPIC_0000001233681833__uef523da032be415385d851be25f401ca"><li id="EN-US_TOPIC_0000001233681833__l27399623db8a4a60ac0865484fb8fd34"><strong id="EN-US_TOPIC_0000001233681833__b842352706112950">SQL_SUCCESS</strong> indicates that the call succeeded.</li><li id="EN-US_TOPIC_0000001233681833__lc44c07913cd64ca8a12429e4b1341df5"><strong id="EN-US_TOPIC_0000001233681833__b842352706112952">SQL_SUCCESS_WITH_INFO</strong> indicates some warning information is displayed.</li><li id="EN-US_TOPIC_0000001233681833__ladc6bb314b9041eaa01fb25708f1171b"><strong id="EN-US_TOPIC_0000001233681833__b842352706112954">SQL_ERROR</strong> indicates major errors, such as memory allocation and connection failures.</li><li id="EN-US_TOPIC_0000001233681833__l3686ebed723d46ffa653c39de3dbfdd6"><strong id="EN-US_TOPIC_0000001233681833__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_0000001233681833__sb16fa7075402443aa3f40e1a314b95ca"><h4 class="sectiontitle">Precautions</h4><p id="EN-US_TOPIC_0000001233681833__a981935ca650c4bb29dda4eda6dd79405">If <strong id="EN-US_TOPIC_0000001233681833__b355637416127">SQLColAttribute</strong> returns <strong id="EN-US_TOPIC_0000001233681833__b31683787161212">SQL_ERROR</strong> or <strong id="EN-US_TOPIC_0000001233681833__b12837117161219">SQL_SUCCESS_WITH_INFO</strong>, the application can then call <a href="dws_04_0143.html">SQLGetDiagRec</a>, set <strong id="EN-US_TOPIC_0000001233681833__b60706181161228">HandleType</strong> and <strong id="EN-US_TOPIC_0000001233681833__b36130306161234">Handle</strong> to <strong id="EN-US_TOPIC_0000001233681833__b14022084161240">SQL_HANDLE_STMT</strong> and <strong id="EN-US_TOPIC_0000001233681833__b4894318161249">StatementHandle</strong>, and obtain the <strong id="EN-US_TOPIC_0000001233681833__b1846530161256">SQLSTATE</strong> value. The <strong id="EN-US_TOPIC_0000001233681833__b861544416135">SQLSTATE</strong> value provides the detailed function calling information.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001233681833__s1ef03ccfd7a241a782daac796b82c927"><h4 class="sectiontitle">Examples</h4><p id="EN-US_TOPIC_0000001233681833__a2387e933fba543848a80cd60fec1cedc">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>
|
|
|