group__easy.html

来自「一个很好用的Linux/Unix下Oracle OCI开发接口封装库」· HTML 代码 · 共 1,235 行 · 第 1/4 页

HTML
1,235
字号
A pointer to an array of strings containing the column names</dl><dl compact><dt><b>See also: </b></dt><dd>
<a class="el" href="group__easy.html#a6">sqlo_fetch</a>, <a class="el" href="group__easy.html#a7">sqlo_values</a>, <a class="el" href="group__easy.html#a4">sqlo_open2</a>, <a class="el" href="group__easy.html#a13">sqlo_close</a>, <a class="el" href="group__easy.html#a10">sqlo_ocol_name_lens</a>. </dl><dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="ex7_8c-example.html#a0">ex7.c</a>.</dl>    </td>
  </tr>
</table>
<a name="a3" doxytag="sqlora.h::sqlo_open"></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"> <a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sqlo_open </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="group__typedefs.html#a0">sqlo_db_handle_t</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>dbh</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>stmt</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>argc</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char **&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>argv</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Open a new cursor.
<p>
This function opens a new cursor for a query statement.
<p>
If the stmt is a SELECT statement, the function sets the attribute  OCI_ATTR_PREFETCH rows to the max arraysize parameter of the library. This is a kind of internal array fetch Oracle provides to speed up the fetching.
<p>
<dl compact><dt><b><a class="el" href="deprecated.html#_deprecated000001">Deprecated: </a></b></dt><dd>
For new developments please use <a class="el" href="group__easy.html#a4">The easy interface</a></dl> <dl compact><dt><b>Parameters: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>dbh</em>&nbsp;</td><td>
I - A database handle </td></tr>
<tr><td valign=top><em>stmt</em>&nbsp;</td><td>
I - A sql statement </td></tr>
<tr><td valign=top><em>argc</em>&nbsp;</td><td>
I - Number of arguments in argv </td></tr>
<tr><td valign=top><em>argv</em>&nbsp;</td><td>
I - Arguments</td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
<ul>
<li>A statement handle <li> &lt; 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 &lt;stdio.h&gt;</span>
<span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<span class="preprocessor">#include "examples.h"</span>

<a class="code" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> open_cursor(<a class="code" href="group__typedefs.html#a0">sqlo_db_handle_t</a> dbh)
{
  <a class="code" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth;
  <span class="keywordtype">int</span> argc = 0;
  <span class="keyword">const</span> <span class="keywordtype">char</span> * argv[1];
  
  argv[argc++] = <span class="stringliteral">"1000"</span>;

  <span class="keywordflow">if</span> ( 0 &gt; (sth = (<a class="code" href="group__easy.html#a3">sqlo_open</a>(dbh, <span class="stringliteral">"SELECT ENAME, SAL FROM EMP WHERE SAL &gt;= :1"</span>, 
                             argc, argv)))) {
    error_exit(dbh, <span class="stringliteral">"sqlo_open"</span>);
  }
  <span class="keywordflow">return</span> sth;
}

<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#a4">sqlo_open2</a>, <a class="el" href="group__easy.html#a6">sqlo_fetch</a>, <a class="el" href="group__easy.html#a7">sqlo_values</a>, <a class="el" href="group__easy.html#a13">sqlo_close</a> </dl><dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="ex4_8c-example.html#a0">ex4.c</a>.</dl>    </td>
  </tr>
</table>
<a name="a4" doxytag="sqlora.h::sqlo_open2"></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_open2 </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>sthp</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="group__typedefs.html#a0">sqlo_db_handle_t</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>dbh</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>stmt</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>argc</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char **&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>argv</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Open a new cursor.
<p>
This function opens a new cursor for a query statement. Use this function if your bind variables are all strings. If you need native datatype support, use <a class="el" href="group__complex.html#a0">The advanced interface.</a>
<p>
If the stmt is a SELECT statement, the function sets the attribute  OCI_ATTR_PREFETCH rows to the max arraysize parameter of the library. This is a kind of internal array fetch Oracle provides to speed up the fetching.
<p>
<dl compact><dt><b>Attention: </b></dt><dd>
You have to init the passed statement handle with SQLO_STH_INIT. This is required escpecially in non-blocking mode.</dl><dl compact><dt><b>Parameters: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>sthp</em>&nbsp;</td><td>
I/O - Returns the new sth in *sthp. </td></tr>
<tr><td valign=top><em>dbh</em>&nbsp;</td><td>
I - A database handle </td></tr>
<tr><td valign=top><em>stmt</em>&nbsp;</td><td>
I - A sql statement </td></tr>
<tr><td valign=top><em>argc</em>&nbsp;</td><td>
I - Number of arguments in argv </td></tr>
<tr><td valign=top><em>argv</em>&nbsp;</td><td>
I - Arguments</td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
<ul>
<li>SQLO_SUCCESS <li>SQLO_STILL_EXECUTING in non-blocking mode <li> &lt; 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 &lt;stdio.h&gt;</span>
<span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<span class="preprocessor">#include "examples.h"</span>

<a class="code" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> open_cursor2(<a class="code" href="group__typedefs.html#a0">sqlo_db_handle_t</a> dbh, <span class="keywordtype">double</span> min_income)
{
  <a class="code" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a> sth = <a class="code" href="group__constants.html#a5a49">SQLO_STH_INIT</a>;
  <span class="keywordtype">int</span> argc = 0;
  <span class="keyword">const</span> <span class="keywordtype">char</span> * argv[1];
  <span class="keywordtype">char</span> hlp[64];

  sprintf(hlp, <span class="stringliteral">"%f"</span>, min_income);

  argv[argc++] = hlp;

  <span class="keywordflow">if</span> ( 0 &gt; (<a class="code" href="group__easy.html#a4">sqlo_open2</a>(&amp;sth, dbh, 
                       <span class="stringliteral">"SELECT ENAME, SAL FROM EMP WHERE SAL &gt;= :1"</span>, 
                       argc, argv))) {
    error_exit(dbh, <span class="stringliteral">"sqlo_open"</span>);
  }

  <span class="keywordflow">return</span> sth;
}
<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#a6">sqlo_fetch</a>, <a class="el" href="group__easy.html#a7">sqlo_values</a>, <a class="el" href="group__easy.html#a13">sqlo_close</a> </dl><dl compact><dt><b>Since: </b></dt><dd>
Version 2.2 </dl><dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="ex5_8c-example.html#a0">ex5.c</a>, and <a class="el" href="ex6_8c-example.html#a0">ex6.c</a>.</dl>    </td>
  </tr>
</table>
<a name="a16" doxytag="sqlora.h::sqlo_prows"></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_prows </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>sth</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Return the number of processed rows by this statement.
<p>
<dl compact><dt><b>Parameters: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>sth</em>&nbsp;</td><td>
I - A statement handle</td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
<ul>
<li>Number of processed rows <li> 0 if it is not a dml statement <li> &lt; 0 on error </ul>
</dl><dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="ex12_8c-example.html#a3">ex12.c</a>.</dl>    </td>
  </tr>
</table>
<a name="a5" doxytag="sqlora.h::sqlo_reopen"></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_reopen </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="group__typedefs.html#a1">sqlo_stmt_handle_t</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>sth</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>argc</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char **&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>argv</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Reopens a already used cursor.
<p>
This function reopens an already used cursor with new bind variables. Reopening cursors improve the speed, because no new parse is necessary.<dl compact><dt><b>Parameters: </b></dt><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>sth</em>&nbsp;</td><td>
I - The sth you want to rebind. </td></tr>
<tr><td valign=top><em>argc</em>&nbsp;</td><td>
I - Number of arguments in argv </td></tr>
<tr><td valign=top><em>argv</em>&nbsp;</td><td>
I - Arguments</td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
<ul>
<li>SQLO_SUCCESS <li>SQLO_STILL_EXECUTING in non-blocking mode <li> &lt; 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 &lt;stdio.h&gt;</span>
<span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<span class="preprocessor">#include "examples.h"</span>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?