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

📄 cresultset.html

📁 对Oracle OCI的封装
💻 HTML
字号:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<H1>Class CResultSet 
<HR>
</H1>
<P>A CResultSet provides access to a table of data generated by executing a 
CStatement. The table rows are retrieved in sequence. Within a row its column 
values can be accessed in any order. 
<P>A CResultSet maintains a cursor pointing to its current row of data. 
Initially the cursor is positioned before the first row. The 'next' method moves 
the cursor to the next row. 
<P>The getXXX methods retrieve column values for the current row. You can 
retrieve values&nbsp;using the index number of the column. Columns are numbered 
from 0. 
<P>For maximum portability, CResultSet columns within each row should be read in 
left-to-right order and each column should be read only once. 
<P>For the getXXX methods, the&nbsp;OCI attempts to convert the underlying data 
to the specified&nbsp;C++ type and returns a suitable&nbsp;C++ value. See 
the&nbsp;OCI specification for allowable mappings from SQL types to&nbsp;C++ 
types with the CResultSet.getXXX methods. 
<P>A CResultSet is automatically closed by the CStatement that generated it when 
that CStatement is closed, re-executed, or is used to retrieve the next result 
from a sequence of multiple results.
<P>The number, types and properties of a CResultSet's columns are provided by 
the&nbsp;CFieldInfo object returned by the getFieldInfo&nbsp;method. 
<P>
<DL>
  <DT><B>See Also:</B> 
  <DD><A href="CStatement.html#executeQuery">executeQuery</A></DD></DL>
<P>
<HR>

<P></P>
<P>
<TABLE border=1 cellPadding=1 cellSpacing=1 style="HEIGHT: 67px; WIDTH: 578px" 
width="75%">
  
  <TR>
    <TD><FONT size=+2><B>Constructor Summary</B></FONT> </TD></TR>
  <TR>
    <TD><STRONG><A 
      href="#CResultSet">CResultSet</A></STRONG>(CStatement* statement) 
      <DD>Constructs a <B>CResultSet</B> object. Your derived class must provide 
      a constructor that calls this one.</DD></TD></TR></TABLE></P>
<P>&nbsp;</P>
<TABLE border=1 cellPadding=1 cellSpacing=1 style="HEIGHT: 63px; WIDTH: 578px" 
width="75%">
  
  <TR>
    <TD colSpan=2><FONT size=+2><B>Method Summary</B></FONT> </TD></TR>
  <TR>
    <TD>
      <P align=right>void</P></TD>
    <TD><STRONG><A 
      href="#close">close</A></STRONG>()
      <DD>Close the resultset.</DD></TD></TR>
  <TR>
    <TD>
      <P align=right>private void</P></TD>
    <TD><STRONG><A 
      href="#describeResult">describeResult</A></STRONG>() 
      <DD>Retrieve information about multiple select-list items.</DD></TD></TR>
  <TR>
    <TD>
      <P align=right>int</P></TD>
    <TD><STRONG><A 
      href="#getDate">getDate</A></STRONG>(const short, tm*)
      <DD>Get the value of a column in the current row as a tm 
  structure.</DD></TD></TR>
  <TR>
    <TD>
      <P align=right>double</P></TD>
    <TD><STRONG><A 
      href="#getDouble">getDouble</A></STRONG>(const short)
      <DD>Get the value of a column in the current row as a double.</DD></TD></TR>
  <TR>
    <TD>
      <P align=right>void </P></TD>
    <TD><STRONG><A 
      href="#getFieldInfo">getFieldInfo</A></STRONG>(const short, CFieldInfo&amp;)<BR>
      <DD>Returns specific kinds of information about the fields in a 
      resultset.</DD></TD></TR>
  <TR>
    <TD>
      <P align=right>short </P></TD>
    <TD><STRONG><A 
      href="#getFieldInfoCount">getFieldInfoCount</A></STRONG>()
      <DD>Returns the number of fields in the recordset.</DD></TD></TR>
  <TR>
    <TD>
      <P align=right>float </P></TD>
    <TD><STRONG><A 
      href="#getFloat">getFloat</A></STRONG>(const short)<BR>
      <DD>Get the value of a column in the current row as a float.</DD></TD></TR>
  <TR>
    <TD>
      <P align=right>int </P></TD>
    <TD><STRONG><A 
      href="#getInt">getInt</A></STRONG>(const short)<BR>
      <DD>Get the value of a column in the current row as an int.</DD></TD></TR>
  <TR>
    <TD>
      <P align=right>unsigned int </P></TD>
    <TD><STRONG><A 
      href="#getLobLenth">getLobLenth</A></STRONG>(const short)<BR>
      <DD>Gets the length of a LOB.</DD></TD></TR>
  <TR>
    <TD>
      <P align=right>long double </P></TD>
    <TD><STRONG><A 
      href="#getLongDouble">getLongDouble</A></STRONG>(const short)
      <DD>Get the value of a column in the current row as a long 
  double.</DD></TD></TR>
  <TR>
    <TD>
      <P align=right>char*</P></TD>
    <TD><STRONG><A 
      href="#getString">getString</A></STRONG>(const short, char*, const short)<BR><DD>Get the value of a column in the current row as a 
      String.</DD>  
                </TD></TR>
  <TR>
    <TD>
      <P align=right>int</P></TD>
    <TD><STRONG><A 
      href="#next">next</A></STRONG>()<BR><DD>A CResultSet is initially positioned before its 
      first row; the first call to next makes the first row the current row; the 
      second call makes the second row the current row, etc.</DD>      
                     
                </TD></TR>
  <TR>
    <TD>
      <P align=right>bool</P></TD>
    <TD><STRONG><A 
      href="#readClob">readClob</A></STRONG>(const short, char*, const short)<BR><DD>Read data from the lob locator.</DD> 
          </TD></TR>
  <TR>
    <TD>
      <P align=right>void</P></TD>
    <TD><STRONG><A 
      href="#setLobOffset">setLobOffset</A></STRONG>(const short index, const unsigned int 
      offset = 1)<BR><DD>Set the absolute offset from the beginning of the 
      LOB value.</DD>          
    </TD></TR>
  <TR>
    <TD>
      <P align=right>int </P></TD>
    <TD><STRONG><A 
      href="#writeClob">writeClob</A></STRONG>(const short, const char*, const short)<BR>
      <DD>Write data into the selected lob locator.</DD></TD></TR></TABLE>
<P>
<P>&nbsp;</P>
<P>
<TABLE border=1 cellPadding=1 cellSpacing=1 style="HEIGHT: 23px; WIDTH: 577px" 
width="75%">
  
  <TR>
    <TD><FONT size=+2><B><FONT size=+2><B>Constructor 
      Detail</B></FONT></B></FONT></TD></TR></TABLE></P>
<A name=CResultSet></A>
<P><STRONG>CResultSet::CResultSet<BR></STRONG></P>
<P><STRONG>CResultSet</STRONG>(<A href="CStatement.html">CStatement</A>* 
statement);</P>
<DL>
  <DD>Constructs a <STRONG>CResultSet</STRONG> object. You can either use 
  <B>CResultSet</B> directly or derive an application-specific class from 
  <B>CResultSet</B>. 
  <DD><B>Parameters:</B> 
  <DL>
    <DD>statement - the CStatement handle.</DD></DL></DD></DL>
<P>&nbsp;</P>
<P>
<TABLE border=1 cellPadding=1 cellSpacing=1 style="HEIGHT: 23px; WIDTH: 577px" 
width="75%">
  
  <TR>
    <TD><FONT size=+2><B>Method Detail</B></FONT></TD></TR></TABLE></P>
<A name=close></A>
<P><STRONG>CResultSet::close<BR></STRONG></P>
<P>void <STRONG>close</STRONG>();</P>
<DL>
  <DD>        Close the resultset. 
</DD></DL>
<HR>
<A name="describeResult"></A>
<P><STRONG>CResultSet::describeResult<BR></STRONG></P>
<P>private void <STRONG>describeResult</STRONG>();</P>
<DL>
  <DD>Retrieve information about multiple select-list items. </DD></DL>
<HR>

<A name=getDate></A>
<P><STRONG>CResultSet::<STRONG>getDate</STRONG><BR></STRONG></P>
<P>int <STRONG>getDate</STRONG>(const short index, tm* time);</P>
<DL>
  <DD>Get the value of a column in the current row as a tm structure. 
  <DD><B>Parameters:</B> 
  <DL>
    <DD>index - the zero-based index of the field. 
    <DD>time - pointer to a tm structure.</DD></DL>
  <DD><STRONG>Returns:</STRONG> 
  <DL>
    <DD>either the error code or 0 for SQL success.</DD></DL></DD></DL>
<HR>
<A name=getDouble></A>
<P><STRONG>CResultSet::<STRONG>getDouble</STRONG><BR></STRONG></P>
<P>double&nbsp;<STRONG>getDouble</STRONG>(const short index);</P>
<DL>
  <DD>Get the value of a column in the current row as a double. 
  <DD><B>Parameters:</B> 
  <DL>
    <DD>index - the zero-based index of the field. </DD></DL>
  <DD><STRONG>Returns:</STRONG> 
  <DL>
    <DD>the column value; if the value is SQL NULL, the result is 0.</DD></DL></DD></DL>
<HR>

<A name=getFieldInfo></A>
<P><STRONG>CResultSet::<STRONG>getFieldInfo</STRONG><BR></STRONG></P>
<P>void&nbsp;<STRONG>getFieldInfo</STRONG>(const short index, CFieldInfo&amp; 
fieldinfo);</P>
<DL>
  <DD>Returns specific kinds of information about the fields in a resultset. 
  <DD><B>Parameters:</B> 
  <DL>
    <DD>index - the zero-based index of the field. 
    <DD>fieldinfo -&nbsp;a reference to a CFieldInfo structure.</DD></DL>
</DD></DL>
<HR>
<A name=getFieldInfoCount></A>
<P><STRONG>CResultSet::<STRONG>getFieldInfoCount</STRONG><BR></STRONG></P>
<P>short&nbsp;<STRONG>getFieldInfoCount</STRONG>  ();</P>
<DL>
  <DD>Returns the number of fields in the recordset. 
  <DD><STRONG>Returns:</STRONG> 
  <DL>
    <DD>  the number of fields in the recordset.</DD></DL></DD></DL>
<HR>
<A name=getFloat></A>
<P><STRONG>CResultSet::<STRONG>getFloat</STRONG><BR></STRONG></P>
<P>double&nbsp;<STRONG>getFloat</STRONG>(const short index);</P>
<DL>
  <DD>Get the value of a column in the current row as a float. 
  <DD><B>Parameters:</B> 
  <DL>
    <DD>index - the zero-based index of the field. </DD></DL>
  <DD><STRONG>Returns:</STRONG> 
  <DL>
    <DD>the column value; if the value is SQL NULL, the result is 0.</DD></DL></DD></DL>
<HR>

<A name=getInt></A>
<P><STRONG>CResultSet::<STRONG>getInt</STRONG><BR></STRONG></P>
<P>int&nbsp;<STRONG>getInt</STRONG>(const short index);</P>
<DL>
  <DD>Get the value of a column in the current row as an int. 
  <DD><B>Parameters:</B> 
  <DL>
    <DD>index - the zero-based index of the field. </DD></DL>
  <DD><STRONG>Returns:</STRONG> 
  <DL>
    <DD>the column value; if the value is SQL NULL, the result is 
0.</DD></DL></DD></DL>
<HR>

<A name=getLobLenth></A>
<P><STRONG>CResultSet::<STRONG>getLobLenth</STRONG><BR></STRONG></P>
<P>unsigned int&nbsp;<STRONG>getLobLenth</STRONG>(const short index);</P>
<DL>
  <DD>Gets the length of a LOB. 
  <DD><B>Parameters:</B> 
  <DL>
    <DD>index - the zero-based index of the field. </DD></DL>
  <DD><STRONG>Returns:</STRONG> 
  <DL>
    <DD>the length of the LOB if the LOB is not NULL. For character LOBs, it is the 
number of characters, for binary LOBs and BFILEs it is the number of bytes in 
the LOB.</DD></DL></DD></DL>
<HR>
<A name=getLongDouble></A>
<P><STRONG>CResultSet::<STRONG>getLongDouble</STRONG><BR></STRONG></P>
<P>long double&nbsp;<STRONG>getLongDouble</STRONG>(const short index);</P>
<DL>
  <DD>Get the value of a column in the current row as a long double. 
  <DD><B>Parameters:</B> 
  <DL>
    <DD>index - the zero-based index of the field. </DD></DL>
  <DD><STRONG>Returns:</STRONG> 
  <DL>
    <DD>the column value; if the value is SQL NULL, the result is 0.</DD></DL></DD></DL>
<HR>
<A name=getString></A>
<P><STRONG>CResultSet::<STRONG>getString</STRONG><BR></STRONG></P>
<P>char*&nbsp;<STRONG>getString</STRONG>(const short index, char* dest, const short len);</P>
<DL>
  <DD>Get the value of a column in the current row as a String. 
  <DD><B>Parameters:</B> 
  <DL>
    <DD>index - the zero-based index of the field. 
    <DD>dest - buffer into which the converted string is placed.
    <DD>len - size of the buffer.</DD></DL>
  <DD><STRONG>Returns:</STRONG> 
  <DL>
    <DD>the destination string. No return value is reserved to indicate an error.</DD></DL></DD></DL>
<HR>

<A name=next></A>
<P><STRONG>CResultSet::<STRONG>next</STRONG><BR></STRONG></P>
<P>int&nbsp;<STRONG>next</STRONG>();</P>
<DL>
  <DD>A CResultSet is initially positioned before its first row; the first call 
  to next makes the first row the current row; the second call makes the second 
  row the current row, etc. 
  <DD><STRONG>Returns:</STRONG> 
  <DL>
    <DD>either the error code or 0 for SQL success.</DD></DL></DD></DL>
<HR>
<A name=readClob></A>
<P><STRONG>CResultSet::<STRONG>readClob</STRONG><BR></STRONG></P>
<P>bool&nbsp;<STRONG>readClob</STRONG>(const short index, char* dest, const short len);</P>
<DL>
  <DD>       Read data from the lob locator. 
  <DD><B>Parameters:</B> 
  <DL>
    <DD>index - the zero-based index of the field. 
    <DD>dest - the pointer to a buffer into which the piece will be read.
    <DD>len - the length of the buffer in octets.</DD></DL>
  <DD><STRONG>Returns:</STRONG> 
  <DL>
    <DD>   nonzero if the OCI_NEED_DATA error code is&nbsp;returned; otherwise 0.</DD></DL></DD></DL>
<HR>

<A name=setLobOffset></A>
<P><STRONG>CResultSet::<STRONG>setLobOffset</STRONG><BR></STRONG></P>
<P>void&nbsp;<STRONG>setLobOffset</STRONG>(const short index, const unsigned int 
offset);</P>
<DL>
  <DD>Set the absolute offset from the beginning of the LOB value. 
  <DD><B>Parameters:</B> 
  <DL>
    <DD>index - the zero-based index of the field. 
    <DD>offset - The absolute offset from the beginning of the LOB value.</DD></DL>
</DD></DL>
<HR>
<A name=writeClob></A>
<P><STRONG>CResultSet::<STRONG>writeClob</STRONG><BR></STRONG></P>
<P>int&nbsp;<STRONG>writeClob</STRONG>  (const short index, const char* source, const short len);</P>
<DL>
  <DD>      Write data into the selected lob locator. 
  <DD><B>Parameters:</B> 
  <DL>
    <DD>index - the zero-based index of the field. 
    <DD>source - the pointer to a buffer from which the piece will be written.
    <DD>len - the length of the buffer in octets.</DD></DL>
  <DD><STRONG>Returns:</STRONG> 
  <DL>
    <DD>   either the error code or 0 for SQL success.</DD></DL></DD></DL>
<HR>
<A href="mailto:yakovlev@zdnetonebox.com">Submit comments/suggestions about 
OCL.</A> <BR>Copyright&nbsp;2001 Sergey Yakovlev. All 
Rights Reserved. 
<P></P>      

</BODY>
</HTML>

⌨️ 快捷键说明

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