group__easy.html

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

HTML
1,235
字号
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>colname</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>colval</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>where</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>
Tests if a value exists in a table.
<p>
Tests if a record exists in a table 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>&nbsp;</td><td>
I - A database handle </td></tr>
<tr><td valign=top><em>table</em>&nbsp;</td><td>
I - A table name </td></tr>
<tr><td valign=top><em>colname</em>&nbsp;</td><td>
I - A column name </td></tr>
<tr><td valign=top><em>colval</em>&nbsp;</td><td>
I - A column value </td></tr>
<tr><td valign=top><em>where</em>&nbsp;</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> &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>

<span class="keywordtype">int</span> table_exists(<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 &gt; (stat = <a class="code" href="group__easy.html#a0">sqlo_exists</a>(dbh, <span class="stringliteral">"USER_TABLES"</span>, <span class="stringliteral">"TABLE_NAME"</span>, table_name, NULL))) {
    error_exit(dbh, <span class="stringliteral">"sqlo_exists"</span>);
   } 
  <span class="keywordflow">return</span> stat == <a class="code" href="group__constants.html#a3a25">SQLO_SUCCESS</a> ? 1 : 0;
 }

<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="ex1_8c-example.html#a0">ex1.c</a>.</dl>    </td>
  </tr>
</table>
<a name="a6" doxytag="sqlora.h::sqlo_fetch"></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_fetch </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>unsigned int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>nrows</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>
Fetches the data from an open cursor.
<p>
This functions fetches data from an open cursor, if the sql was a query. For non-queries, the statement is executed. Use <a class="el" href="group__easy.html#a7">The easy interface</a> to get the data. <dl compact><dt><b>Attention: </b></dt><dd>
nrows must be 1 for cursors opened with <a class="el" href="group__easy.html#a3">The easy interface</a> or @sqlo_open2. For cursors where the output variables were defined manually with @sqlo_define_by_pos, this can be for example the size of the array in which you are fetching.</dl><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>
<tr><td valign=top><em>nrows</em>&nbsp;</td><td>
I - The number of rows to fetch.</td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
<ul>
<li>SQLO_SUCCESS <li>SQLO_NO_DATA <li>&lt; 0 on error </ul>
</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#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="ex11_8c-example.html#a2">ex11.c</a>, <a class="el" href="ex12_8c-example.html#a2">ex12.c</a>, <a class="el" href="ex17_8c-example.html#a4">ex17.c</a>, <a class="el" href="ex18_8c-example.html#a4">ex18.c</a>, <a class="el" href="ex19_8c-example.html#a5">ex19.c</a>, and <a class="el" href="ex7_8c-example.html#a2">ex7.c</a>.</dl>    </td>
  </tr>
</table>
<a name="a15" doxytag="sqlora.h::sqlo_isopen"></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_isopen </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>
Test if a cursor is open.
<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>SQLO_SUCCESS if the cursor is open <li>1 if not (unused sth) <li>SQLO_INVALID_STMT_HANDLE. </ul>
</dl><dl compact><dt><b>See also: </b></dt><dd>
<a class="el" href="group__easy.html#a4">sqlo_open2</a> </dl>    </td>
  </tr>
</table>
<a name="a11" doxytag="sqlora.h::sqlo_ncols"></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_ncols </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>in</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>
Get the number of bind/select-list variables.
<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>
<tr><td valign=top><em>in</em>&nbsp;</td><td>
I - 1 returns the number of bind variables, 0 returns the number of select list columns.</td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
<ul>
<li>The number of columns <li>SQLO_INVALID_STMT_HANDLE </ul>
</dl>    </td>
  </tr>
</table>
<a name="a10" doxytag="sqlora.h::sqlo_ocol_name_lens"></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 int* sqlo_ocol_name_lens </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>num</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>
Get the select list columns name lengths.
<p>
Use this function to get the length of each select list column.  Call this when you need the length of the column, for formatting purposes etc.<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>
<tr><td valign=top><em>num</em>&nbsp;</td><td>
O - A destination where the function can write the size of the returned array.</td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>
A pointer to an array of integers containing the lengths</dl><dl compact><dt><b>See also: </b></dt><dd>
<a class="el" href="group__easy.html#a9">sqlo_ocol_names</a>, <a class="el" href="group__easy.html#a6">sqlo_fetch</a>, <a class="el" href="group__easy.html#a4">sqlo_open2</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="ex7_8c-example.html#a1">ex7.c</a>.</dl>    </td>
  </tr>
</table>
<a name="a9" doxytag="sqlora.h::sqlo_ocol_names"></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_ocol_names </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>num</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>
Get the select list columns.
<p>
Use this function to get the select list column names.  Most usefull for dynamic sql, where you don't know the sql statement at all.<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>
<tr><td valign=top><em>num</em>&nbsp;</td><td>
O - A destination where the function can write the size of the returned array (optional).</td></tr>
</table>
</dl><dl compact><dt><b>Returns: </b></dt><dd>

⌨️ 快捷键说明

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