group__easy.html
来自「一个很好用的Linux/Unix下Oracle OCI开发接口封装库」· HTML 代码 · 共 1,235 行 · 第 1/4 页
HTML
1,235 行
<!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>The easy interface</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>The easy interface</h1>Functions in this group use basically bind variables passed as strings in an argv.
<a href="#_details">More...</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__easy.html#a0">sqlo_exists</a> (<a class="el" href="group__typedefs.html#a0">sqlo_db_handle_t</a> dbh, const char *table, const char *colname, const char *colval, const char *where)</td></tr>
<tr><td> </td><td><font size=-1><em>Tests if a value exists in a table.</em> <a href="#a0"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__easy.html#a1">sqlo_count</a> (<a class="el" href="group__typedefs.html#a0">sqlo_db_handle_t</a> dbh, const char *table, const char *colname, const char *colval, const char *where)</td></tr>
<tr><td> </td><td><font size=-1><em>Counts the number of items in the table.</em> <a href="#a1"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__easy.html#a2">sqlo_run</a> (<a class="el" href="group__typedefs.html#a0">sqlo_db_handle_t</a> dbh, const char *stmt, int argc, const char **argv)</td></tr>
<tr><td> </td><td><font size=-1><em>Run a simple sql statements with parameters.</em> <a href="#a2"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top><a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> </td><td valign=bottom><a class="el" href="group__easy.html#a3">sqlo_open</a> (<a class="el" href="group__typedefs.html#a0">sqlo_db_handle_t</a> dbh, const char *stmt, int argc, const char **argv)</td></tr>
<tr><td> </td><td><font size=-1><em>Open a new cursor.</em> <a href="#a3"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__easy.html#a4">sqlo_open2</a> (<a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> *sthp, <a class="el" href="group__typedefs.html#a0">sqlo_db_handle_t</a> dbh, const char *stmt, int argc, const char **argv)</td></tr>
<tr><td> </td><td><font size=-1><em>Open a new cursor.</em> <a href="#a4"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__easy.html#a5">sqlo_reopen</a> (<a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth, int argc, const char **argv)</td></tr>
<tr><td> </td><td><font size=-1><em>Reopens a already used cursor.</em> <a href="#a5"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__easy.html#a6">sqlo_fetch</a> (<a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth, unsigned int nrows)</td></tr>
<tr><td> </td><td><font size=-1><em>Fetches the data from an open cursor.</em> <a href="#a6"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>const char ** </td><td valign=bottom><a class="el" href="group__easy.html#a7">sqlo_values</a> (<a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth, int *num, int dostrip)</td></tr>
<tr><td> </td><td><font size=-1><em>Get one dataset.</em> <a href="#a7"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>const unsigned short * </td><td valign=bottom><a class="el" href="group__easy.html#a8">sqlo_value_lens</a> (<a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth, int *num)</td></tr>
<tr><td> </td><td><font size=-1><em>Get the length of the returned values.</em> <a href="#a8"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>const char ** </td><td valign=bottom><a class="el" href="group__easy.html#a9">sqlo_ocol_names</a> (<a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth, int *num)</td></tr>
<tr><td> </td><td><font size=-1><em>Get the select list columns.</em> <a href="#a9"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>const int * </td><td valign=bottom><a class="el" href="group__easy.html#a10">sqlo_ocol_name_lens</a> (<a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth, int *num)</td></tr>
<tr><td> </td><td><font size=-1><em>Get the select list columns name lengths.</em> <a href="#a10"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__easy.html#a11">sqlo_ncols</a> (<a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth, int in)</td></tr>
<tr><td> </td><td><font size=-1><em>Get the number of bind/select-list variables.</em> <a href="#a11"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>const char * </td><td valign=bottom><a class="el" href="group__easy.html#a12">sqlo_command</a> (<a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth)</td></tr>
<tr><td> </td><td><font size=-1><em>Return the sql command.</em> <a href="#a12"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__easy.html#a13">sqlo_close</a> (<a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth)</td></tr>
<tr><td> </td><td><font size=-1><em>Close the cursor.</em> <a href="#a13"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__easy.html#a14">sqlo_exec</a> (<a class="el" href="group__typedefs.html#a0">sqlo_db_handle_t</a> dbh, const char *stmt)</td></tr>
<tr><td> </td><td><font size=-1><em>Execute a simple sql statement.</em> <a href="#a14"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__easy.html#a15">sqlo_isopen</a> (<a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth)</td></tr>
<tr><td> </td><td><font size=-1><em>Test if a cursor is open.</em> <a href="#a15"></a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group__easy.html#a16">sqlo_prows</a> (<a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth)</td></tr>
<tr><td> </td><td><font size=-1><em>Return the number of processed rows by this statement.</em> <a href="#a16"></a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Functions in this group use basically bind variables passed as strings in an argv.
<p>
The query results are also converted to strings. <hr><h2>Function Documentation</h2>
<a name="a13" doxytag="sqlora.h::sqlo_close"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int sqlo_close </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> </td>
<td class="mdname1" valign="top" nowrap> <em>sth</em> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Close the cursor.
<p>
Closes the cursor and releases the Oracle statement handle.
<p>
<dl compact><dt><b>Returns: </b></dt><dd>
<ul>
<li>SQLO_SUCCESS <li>< 0 on error </ul>
</dl><dl compact><dt><b>See also: </b></dt><dd>
<a class="el" href="group__easy.html#a3">sqlo_open</a>. </dl><dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="ex12_8c-example.html#a4">ex12.c</a>, <a class="el" href="ex13_8c-example.html#a6">ex13.c</a>, <a class="el" href="ex14_8c-example.html#a6">ex14.c</a>, <a class="el" href="ex15_8c-example.html#a7">ex15.c</a>, <a class="el" href="ex16_8c-example.html#a8">ex16.c</a>, <a class="el" href="ex17_8c-example.html#a6">ex17.c</a>, <a class="el" href="ex18_8c-example.html#a5">ex18.c</a>, <a class="el" href="ex19_8c-example.html#a6">ex19.c</a>, <a class="el" href="ex7_8c-example.html#a5">ex7.c</a>, and <a class="el" href="ex9_8c-example.html#a3">ex9.c</a>.</dl> </td>
</tr>
</table>
<a name="a12" doxytag="sqlora.h::sqlo_command"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> const char* sqlo_command </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> </td>
<td class="mdname1" valign="top" nowrap> <em>sth</em> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Return the sql command.
<p>
<dl compact><dt><b>Returns: </b></dt><dd>
The active sql statement of the sth.</dl><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 - A statement handle </td></tr>
</table>
</dl> </td>
</tr>
</table>
<a name="a1" doxytag="sqlora.h::sqlo_count"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int sqlo_count </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="group__typedefs.html#a0">sqlo_db_handle_t</a> </td>
<td class="mdname" nowrap> <em>dbh</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>table</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>colname</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>colval</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>where</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>
Counts the number of items in the table.
<p>
Counts the number of items where field = value [AND where]<dl compact><dt><b>Parameters: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>dbh</em> </td><td>
I - A database handle </td></tr>
<tr><td valign=top><em>table</em> </td><td>
I - A table name </td></tr>
<tr><td valign=top><em>colname</em> </td><td>
I - A column name </td></tr>
<tr><td valign=top><em>colval</em> </td><td>
I - A column value </td></tr>
<tr><td valign=top><em>where</em> </td><td>
I - More conditions (optional)</td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
<ul>
<li>SQLO_SUCCESS <li>SQLO_NO_DATA <li> < 0 on error </ul>
</dl><dl compact><dt><b>Example:</b></dt><dd>
<div class="fragment"><pre><span class="comment">/* $Id: group__easy.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>
<span class="keywordtype">int</span> col_count(<a class="code" href="group__typedefs.html#a0">sqlo_db_handle_t</a> dbh, <span class="keywordtype">char</span> * table_name)
{
<span class="keywordtype">int</span> stat;
<span class="keywordflow">if</span> ( 0 > (stat = <a class="code" href="group__easy.html#a1">sqlo_count</a>(dbh, <span class="stringliteral">"USER_TAB_COLUMNS"</span>, <span class="stringliteral">"TABLE_NAME"</span>, table_name, NULL))) {
error_exit(dbh, <span class="stringliteral">"sqlo_count"</span>);
}
<span class="keywordflow">return</span> stat;
}
<span class="comment">/* $Id: group__easy.html,v 1.1 2005/01/13 02:56:43 cvsroot Exp $ */</span>
</pre></div> </dl><dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="ex2_8c-example.html#a0">ex2.c</a>.</dl> </td>
</tr>
</table>
<a name="a14" doxytag="sqlora.h::sqlo_exec"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int sqlo_exec </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="group__typedefs.html#a0">sqlo_db_handle_t</a> </td>
<td class="mdname" nowrap> <em>dbh</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>stmt</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>
Execute a simple sql statement.
<p>
Use this to execute non-qeuery statements without bind variables.<dl compact><dt><b>Parameters: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>dbh</em> </td><td>
A database handle </td></tr>
<tr><td valign=top><em>stmt</em> </td><td>
A sql statement</td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
The number of processed rows (DML statements), 0 (non DML statements) or < 0 on error.</dl><dl compact><dt><b>Example:</b></dt><dd>
<div class="fragment"><pre><span class="comment">/* $Id: group__easy.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>
<span class="keywordtype">int</span> update_emp(<a class="code" href="group__typedefs.html#a0">sqlo_db_handle_t</a> dbh, <span class="keywordtype">double</span> factor, <span class="keyword">const</span> <span class="keywordtype">char</span> * job)
{
<span class="keywordtype">int</span> stat;
<span class="keywordtype">char</span> stmt[1024];
sprintf(stmt, <span class="stringliteral">"UPDATE EMP SET SAL = SAL * %f WHERE JOB = '%s'"</span>,
factor, job);
<span class="keywordflow">if</span> ( 0 > (stat = <a class="code" href="group__easy.html#a14">sqlo_exec</a>(dbh, stmt)))
error_exit(dbh, <span class="stringliteral">"sqlo_run"</span>);
<span class="keywordflow">return</span> stat; <span class="comment">/* number of processed rows */</span>
}
<span class="comment">/* $Id: group__easy.html,v 1.1 2005/01/13 02:56:43 cvsroot Exp $ */</span>
</pre></div></dl><dl compact><dt><b>See also: </b></dt><dd>
<a class="el" href="group__easy.html#a2">sqlo_run</a> </dl><dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="ex13_8c-example.html#a7">ex13.c</a>, <a class="el" href="ex8_8c-example.html#a0">ex8.c</a>, and <a class="el" href="ex9_8c-example.html#a4">ex9.c</a>.</dl> </td>
</tr>
</table>
<a name="a0" doxytag="sqlora.h::sqlo_exists"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int sqlo_exists </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="group__typedefs.html#a0">sqlo_db_handle_t</a> </td>
<td class="mdname" nowrap> <em>dbh</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>table</em>, </td>
</tr>
<tr>
<td></td>
<td></td>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?