📄 otl4_refcur_stream.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> void set_column_type(const int column_ndx,<br> const int col_type,<br> const int col_size=0);<br> void set_all_column_types(const unsigned mask=0);<br><br> void rewind(void);<br> int is_null(void);<br> int eof(void);<br> void close(void);<br><br> otl_column_desc* describe_select(int& desc_len);<br><br> <a
name="describe_out_vars"></a>otl_var_desc* describe_out_vars(int& desc_len);<br> <a
name="describe_next_out_var"></a>otl_var_desc* describe_next_out_var(void); <br><br> otl_refcur_stream& operator>>(char& c);<br> otl_refcur_stream& operator>>(unsigned char& c);<br> otl_refcur_stream& operator>>(char* s);<br> otl_refcur_stream& operator>>(unsigned char* s);<br> otl_refcur_stream& operator>>(int& n);<br> otl_refcur_stream& operator>>(unsigned& u);<br> otl_refcur_stream& operator>>(short& sh);<br> otl_refcur_stream& operator>>(long int& l);<br> otl_refcur_stream& operator>>(float& f);<br> otl_refcur_stream& operator>>(double& d);<br><br> <a
name="OTL_BIGINT"></a>otl_refcur_stream& operator>>(<a
href="otl3_compile.htm#OTL_BIGINT">OTL_BIGINT</a>& 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> otl_refcur_stream& operator>>(<a
href="otl3_long_string.htm">otl_long_string</a>& s); // read the LOB from the stream<br> otl_refcur_stream& operator>>(<a
href="otl3_stream_class.htm#otl_datetime">otl_datetime</a>& dt); // read date/time info from the stream<br> otl_refcur_stream& operator>>(<a
href="otl3_lob_stream.htm">otl_lob_stream</a>& lob); <br> // read reference to CLOB/BLOB from otl_ref_stream <br> // into otl_lob_stream (OCI8). In other words,<br> // initialize otl_lob_stream for reading CLOB/BLOB <br> // in stream mode<br> otl_refcur_stream& operator>>(std::string& s); <br> // Read the ANSI C++ std::string. This operator can<br> // read VARCHAR/CHAR table fields as well as large string<br> // objects (TEXT, LONG, CLOB, etc.)<br><br>If #define <a
href="otl3_compile#OTL:_UNICODE">OTL_UNICODE</a> is enabled, the following operators have <br>special meaning:<br><br> otl_stream& operator>>(unsigned char* s);<br> // returns a null terminated array of unsigned short's<br> // (double-byte Unicode characters). Therefore, "unsigned char*" <br> // needs to be type cast to "unsigned short*". Also, it's recommended<br> // to allocate 2 bytes per each Unicode character. plus 2 bytes per <br> // possible surrogate character.<br><br> otl_stream& operator>>(<a
href="otl3_long_string.htm#otl_long_unicode_string">otl_long_unicode_string</a>& s); <br> // 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 © 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 + -