⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 otl4_refcur_stream.htm

📁 otl是c++数据库封装好的一个数据库接口
💻 HTM
字号:
<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
  <meta http-equiv="Content-Type"
 content="text/html; charset=iso-8859-1">
  <meta name="Author" content="Sergei Kuchin">
  <meta name="GENERATOR"
 content="Mozilla/4.77 [en] (Win95; U) [Netscape]">
  <meta name="KeyWords"
 content="OTL, Oracle, ODBC, DB2, CLI, database API, C++, Template Library">
  <title>OTL 4.0, OTL reference cursor stream</title>
</head>
<body>
<center>
<h1>OTL 4.0, OTL reference cursor stream class</h1>
</center>
<h1>
<a name="otl_refcur_stream"></a>OTL reference cursor stream class</h1>
This class (otl_refcur_stream) is used for reading rows from a <a
 href="otl3_bind_variables.htm#refcur">reference
cursor</a> bind variable. The class is defined for OTL/OCI8/8i/9i/10g
only.
It's
similar to the <a href="otl3_stream_class.htm">otl_stream</a> class
itself,
when the otl_stream is instantiated with a SELECT statement, or with a
single reference cursor. otl_refcur_stream can be initiliazed by <a
 href="otl3_stream_class.htm#stream_read_refcur">reading</a>
a reference cursor descriptor from an otl_stream. The class, in tandem
with the <a href="otl3_bind_variables.htm#refcur">refcur</a>
placeholder,
allows the otl_stream to return multiple reference cursors from a
stored
procedure call in one shot.
<p>Potentially, the otl_refcur_stream class may raise an <a
 href="otl3_exc_list.htm">OTL
defined exception</a>.
</p>
<p>All of the functions, defined in this class, mimick the <a
 href="otl3_stream_class.htm">otl_stream</a>
functions, therefore, see the descriptions of the corresponding
functions
in <a href="otl3_stream_class.htm">otl_stream</a>.
</p>
<pre><font size="+2">class otl_refcur_stream {<br>public:</font></pre>
<pre>&nbsp;void set_column_type(const int column_ndx,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const int col_type,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const int col_size=0);<br>&nbsp;void set_all_column_types(const unsigned mask=0);<br><br>&nbsp;void rewind(void);<br>&nbsp;int is_null(void);<br>&nbsp;int eof(void);<br>&nbsp;void close(void);<br><br>&nbsp;otl_column_desc* describe_select(int&amp; desc_len);<br><br> <a
 name="describe_out_vars"></a>otl_var_desc* describe_out_vars(int&amp; desc_len);<br> <a
 name="describe_next_out_var"></a>otl_var_desc* describe_next_out_var(void); <br><br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(char&amp; c);<br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(unsigned char&amp; c);<br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(char* s);<br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(unsigned char* s);<br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(int&amp; n);<br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(unsigned&amp; u);<br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(short&amp; sh);<br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(long int&amp; l);<br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(float&amp; f);<br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(double&amp; d);<br><br> <a
 name="OTL_BIGINT"></a>otl_refcur_stream&amp; operator&gt;&gt;(<a
 href="otl3_compile.htm#OTL_BIGINT">OTL_BIGINT</a>&amp; n);<br>     // Reads a string (char) value from the stream and converts it to<br>     // a signed 64-bit integer. This operator is useful for reading <br>     // large whole numbers that are larger than the "double"<br>     // container can hold. The underlying SELECT statement that gets returned<br>     // to C++ via a reference cursor should explicitly convert numeric values<br>     // to strings, for example: LTRIM(TO_CHAR(my_large_num))<br><br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(<a
 href="otl3_long_string.htm">otl_long_string</a>&amp; s); // read the LOB from the stream<br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(<a
 href="otl3_stream_class.htm#otl_datetime">otl_datetime</a>&amp; dt); // read date/time info from the stream<br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(<a
 href="otl3_lob_stream.htm">otl_lob_stream</a>&amp; lob);&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // read reference to CLOB/BLOB from otl_ref_stream&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // into otl_lob_stream (OCI8). In other words,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // initialize otl_lob_stream for reading CLOB/BLOB&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // in stream mode<br>&nbsp;otl_refcur_stream&amp; operator&gt;&gt;(std::string&amp; s);&nbsp;<br>&nbsp;&nbsp; // Read the ANSI C++ std::string. This operator can<br>&nbsp;&nbsp; // read VARCHAR/CHAR table fields as well as large string<br>&nbsp;&nbsp; // objects (TEXT, LONG, CLOB, etc.)<br><br>If #define <a
 href="otl3_compile#OTL:_UNICODE">OTL_UNICODE</a> is enabled, the following operators have&nbsp;<br>special meaning:<br><br>&nbsp; otl_stream&amp; operator&gt;&gt;(unsigned char* s);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // returns a null terminated array of unsigned short's<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // (double-byte Unicode characters). Therefore, "unsigned char*"&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // needs to be type cast to "unsigned short*". Also, it's recommended<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // to allocate 2 bytes per each Unicode character. plus 2 bytes per&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // possible surrogate character.<br><br>&nbsp; otl_stream&amp; operator&gt;&gt;(<a
 href="otl3_long_string.htm#otl_long_unicode_string">otl_long_unicode_string</a>&amp; s);&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // read the Unicode LOB from the stream</pre>
<pre><font size="+2">}; // end of otl_refcur_stream</font></pre>
<p>
</p>
<hr width="100%">
<center>
<p><a href="otl3_pl_tab.htm">Prev</a> <a href="otl3_iterators.htm">Next
</a><a href="otl3.htm">Contents
</a><a href="home.htm">Go
Home</a></p>
</center>
<p>Copyright &copy; 1996, 2008, Sergei Kuchin, email: <a
 href="mailto:skuchin@aceweb.com">skuchin@aceweb.com</a>,
<a href="mailto:skuchin@gmail.com">skuchin@gmail.com
<script language="JavaScript"><!-- hide from old browsers
 var modDate = new Date(document.lastModified)
 document.write("<i> Last Updated:</i> " + (modDate.getMonth()+1) + "/" + 
                modDate.getDate() + "/" + "0"+(modDate.getYear())%100+".");
 //-->
 </script></a>.
</p>
<p><i>Permission to use, copy, modify and redistribute this document
for
any purpose is hereby granted without fee, provided that the above
copyright
notice appear in all copies.</i>
</p>
</body>
</html>

⌨️ 快捷键说明

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