ex11_8c-example.html
来自「一个很好用的Linux/Unix下Oracle OCI开发接口封装库」· HTML 代码 · 共 55 行
HTML
55 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Example Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.18 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="globals.html">Globals</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindex" href="examples.html">Examples</a> </center>
<hr><h1>ex11.c</h1> Example for using sqlo_define_by_pos and sqlo_execute.
<p>
<div class="fragment"><pre><span class="comment">/* $Id: ex11_8c-example.html,v 1.1 2005/01/13 02:56:43 cvsroot 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#a1">sqlo_stmt_handle_t</a> do_select2(<a class="code" href="group__typedefs.html#a0">sqlo_db_handle_t</a> dbh, <span class="keywordtype">double</span> min_salary)
{
<a class="code" href="group__typedefs.html#a1">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#a3a25">SQLO_SUCCESS</a> !=
(<a name="a0"></a><a class="code" href="group__complex.html#a5">sqlo_define_by_pos</a>(sth, 1, <a class="code" href="group__constants.html#a6a58">SQLOT_STR</a>, name, <span class="keyword">sizeof</span>(name), &name_ind, &name_rlen, 0)) ||
(<a class="code" href="group__complex.html#a5">sqlo_define_by_pos</a>(sth, 2, <a class="code" href="group__constants.html#a6a57">SQLOT_FLT</a>, &salary, <span class="keyword">sizeof</span>(salary), &sal_ind, 0, 0))) {
error_exit(dbh, <span class="stringliteral">"sqlo_define_by_pos"</span>);
}
status = <a name="a1"></a><a class="code" href="group__complex.html#a8">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#a3a25">SQLO_SUCCESS</a> == (status = <a name="a2"></a><a class="code" href="group__easy.html#a6">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#a3a32">SQLO_NO_DATA</a>)
error_exit(dbh, <span class="stringliteral">"sqlo_fetch"</span>);
<span class="keywordflow">return</span> sth;
}
<span class="comment">/* $Id: ex11_8c-example.html,v 1.1 2005/01/13 02:56:43 cvsroot Exp $ */</span>
</pre></div><hr><address style="align: right;"><small>Generated on Thu Aug 14 18:02:53 2003 for libsqlora8 by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.18 </small></address>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?