📄 group__complex.html
字号:
</tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>value_type</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>const void * </td> <td class="mdname" nowrap> <em>value_addr</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>unsigned int </td> <td class="mdname" nowrap> <em>value_size</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>short * </td> <td class="mdname" nowrap> <em>ind_addr</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>short * </td> <td class="mdname" nowrap> <em>rlen_addr</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>is_array</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Define a output variable of the select list. <p>Use this to define the output variables.<p>If is_array is 1, the parameters value_addr, rlen_addr and ind_addr must point to arrays. ind_addr is optional and can be passed a NULL. Passing NULL is only usefull for NOT NULL columns. If you ommit the indicator and a NULL is fetched, <a class="el" href="group__complex.html#ga8">sqlo_execute</a> will fail with an Oracle error (FETCHED COLUMN VALUE IS NULL).<p>The value_size is still the size of one array element, not the whole array size!<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign=top><em>sth</em> </td><td>I - The statement handle </td></tr> <tr><td valign=top><em>value_pos</em> </td><td>I - The bind parameter position in the string. Starts with 1 for the first. </td></tr> <tr><td valign=top><em>value_type</em> </td><td>I - The datatype of the bind parameter (<a class="el" href="group__constants.html#ga6">sqlo_data_types</a>). </td></tr> <tr><td valign=top><em>value_addr</em> </td><td>I - The pointer to the parameter data. </td></tr> <tr><td valign=top><em>value_size</em> </td><td>I - The size of the object at param_addr in bytes. </td></tr> <tr><td valign=top><em>ind_addr</em> </td><td>I - The pointer to the NULL indicator variable (optional). </td></tr> <tr><td valign=top><em>rlen_addr</em> </td><td>I - The pointer where <a class="el" href="group__complex.html#ga8">sqlo_execute</a> writes the actual returned length. </td></tr> <tr><td valign=top><em>is_array</em> </td><td>I - 1 means param_addr points to an array, 0 means a single variable.</td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd><ul><li>SQLO_SUCCESS </li><li>< 0 on error </li></ul></dd></dl><dl compact><dt><b>Example:</b></dt><dd><div class="fragment"><pre><span class="comment">/* $Id: ex11.c,v 1.4 2002/08/24 12:54:47 kpoitschke Exp $ */</span><span class="preprocessor">#include <stdio.h></span><span class="preprocessor">#include <stdlib.h></span><span class="preprocessor">#include "examples.h"</span><a class="code" href="group__typedefs.html#ga1">sqlo_stmt_handle_t</a> do_select2(<a class="code" href="group__typedefs.html#ga0">sqlo_db_handle_t</a> dbh, <span class="keywordtype">double</span> min_salary){ <a class="code" href="group__typedefs.html#ga1">sqlo_stmt_handle_t</a> sth; <span class="comment">/* statement handle */</span> <span class="keywordtype">int</span> status; <span class="comment">/* return code of sqlo_... */</span> <span class="keywordtype">char</span> name[64]; <span class="comment">/* output variable for NAME */</span> <span class="keywordtype">short</span> name_rlen; <span class="comment">/* returned length of NAME */</span> <span class="keywordtype">short</span> name_ind; <span class="comment">/* NULL indicator for NAME */</span> <span class="keywordtype">short</span> sal_ind; <span class="comment">/* NULL indicator for SALARY */</span> <span class="keywordtype">double</span> salary = min_salary; <span class="comment">/* input variable for SALARY */</span> sth = prepare_cursor(dbh, &salary); <span class="comment">/* see ex10.c */</span> <span class="comment">/* define output */</span> <span class="keywordflow">if</span> (<a class="code" href="group__constants.html#gga3a25">SQLO_SUCCESS</a> != (<a class="code" href="group__complex.html#ga192">sqlo_define_by_pos</a>(sth, 1, SQLOT_STR, name, <span class="keyword">sizeof</span>(name), &name_ind, &name_rlen, 0)) || (<a class="code" href="group__complex.html#ga192">sqlo_define_by_pos</a>(sth, 2, SQLOT_FLT, &salary, <span class="keyword">sizeof</span>(salary), &sal_ind, 0, 0))) { error_exit(dbh, <span class="stringliteral">"sqlo_define_by_pos"</span>); } status = <a class="code" href="group__complex.html#ga194">sqlo_execute</a>(sth, 0); <span class="keywordflow">if</span> ( 0 > status) error_exit(dbh, <span class="stringliteral">"sqlo_execute"</span>); <span class="keywordflow">while</span> ( <a class="code" href="group__constants.html#gga3a25">SQLO_SUCCESS</a> == (status = <a class="code" href="group__easy.html#ga167">sqlo_fetch</a>(sth, 1))) { printf(<span class="stringliteral">"Name=%-8s Salary=%6.2f\n"</span>, name, salary); } <span class="keywordflow">if</span> (status != <a class="code" href="group__constants.html#gga3a32">SQLO_NO_DATA</a>) error_exit(dbh, <span class="stringliteral">"sqlo_fetch"</span>); <span class="keywordflow">return</span> sth;}<span class="comment">/* $Id: ex11.c,v 1.4 2002/08/24 12:54:47 kpoitschke Exp $ */</span></pre></div></dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__complex.html#ga0">sqlo_prepare</a>, <a class="el" href="group__complex.html#ga1">sqlo_bind_by_name</a>, <a class="el" href="group__complex.html#ga5">sqlo_define_by_pos</a> </dd></dl><p>Definition at line <a class="el" href="sqlora_8c-source.html#l06782">6782</a> of file <a class="el" href="sqlora_8c-source.html">sqlora.c</a>.<p>References <a class="el" href="sqlora_8c-source.html#l03222">_define_by_pos()</a>, <a class="el" href="sqlora_8c-source.html#l02822">_get_data_type_str()</a>, <a class="el" href="sqlora_8c-source.html#l04319">_get_trace_fp()</a>, <a class="el" href="sqlora_8c-source.html#l00367">CHECK_STHANDLE</a>, <a class="el" href="sqlora_8c-source.html#l00565">_sqlo_stmt_struct::dbp</a>, <a class="el" href="group__complex.html#ga7">sqlo_define_ntable()</a>, <a class="el" href="group__constants.html#gga4a36">SQLO_INVALID_STMT_HANDLE</a>, <a class="el" href="sqlora_8c.html#a35">sqlo_stmt_struct_ptr_t</a>, <a class="el" href="group__constants.html#gga6a85">SQLOT_RSET</a>, and <a class="el" href="sqlora_8c-source.html#l00238">TRACE</a>. </td> </tr></table><p>Here is the call graph for this function:<p><center><img src="group__complex_ga5_cgraph.png" border="0" usemap="#group__complex_ga5_cgraph_map" alt=""></center><map name="group__complex_ga5_cgraph_map"><area href="sqlora_8c.html#a114" shape="rect" coords="207,92,316,110" alt=""><area href="sqlora_8c.html#a128" shape="rect" coords="551,52,647,70" alt=""><area href="sqlora_8c.html#a111" shape="rect" coords="372,141,503,160" alt=""><area href="group__complex.html#ga7" shape="rect" coords="199,236,324,254" alt=""><area href="sqlora_8c.html#a122" shape="rect" coords="387,5,488,24" alt=""><area href="sqlora_8c.html#a109" shape="rect" coords="391,98,484,117" alt=""></map><a class="anchor" name="ga6" doxytag="sqlora.h::sqlo_define_by_pos2" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int sqlo_define_by_pos2 </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group__typedefs.html#ga1">sqlo_stmt_handle_t</a> </td> <td class="mdname" nowrap> <em>sth</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>value_pos</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>value_type</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>const void * </td> <td class="mdname" nowrap> <em>value_addr</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>unsigned int </td> <td class="mdname" nowrap> <em>value_size</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>short * </td> <td class="mdname" nowrap> <em>ind_addr</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>unsigned short * </td> <td class="mdname" nowrap> <em>rlen_addr</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>unsigned short * </td> <td class="mdname" nowrap> <em>rcode_addr</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>unsigned int </td> <td class="mdname" nowrap> <em>skip_size</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Define a output variable of the select list. <p>Use this to define where the result of the query should go. This new version supports filling arrays of structures. If skip_size is not 0, the parameter value_addr must point to an array of structures. If used, the structure must contain variables for ind, rlen and rcode.<p>The value_size is still the size of one array element, not the whole array size!<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign=top><em>sth</em> </td><td>I - The statement handle </td></tr> <tr><td valign=top><em>value_pos</em> </td><td>I - The bind parameter position in the string. Starts with 1 for the first. </td></tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -