Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 10179

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>sybase_unbuffered_query</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="Sybase Functions"
HREF="ref.sybase.html"><LINK
REL="PREVIOUS"
TITLE="sybase_set_message_handler"
HREF="function.sybase-set-message-handler.html"><LINK
REL="NEXT"
TITLE="TCP Wrappers Functions"
HREF="ref.tcpwrap.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.sybase-set-message-handler.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="ref.tcpwrap.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.sybase-unbuffered-query"
></A
>sybase_unbuffered_query</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN233262"
></A
><P
>    (PHP 4 &#62;= 4.3.0, PHP 5)</P
>sybase_unbuffered_query&nbsp;--&nbsp;Send a Sybase query and do not block</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN233265"
></A
><H2
>Description</H2
>resource <B
CLASS="methodname"
>sybase_unbuffered_query</B
> ( string query, resource link_identifier [, bool store_result] )<BR
></BR
><P
>&#13;   Returns a positive Sybase result identifier on success, or
   <TT
CLASS="constant"
><B
>FALSE</B
></TT
> on error.
  </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>注意: </B
>本函数仅适用于 Sybase 的 CT 库接口,而不适用于 DB 库。</P
></BLOCKQUOTE
></DIV
><P
> 
   <B
CLASS="function"
>sybase_unbuffered_query()</B
> sends a query to the 
   currently active database on the server that's associated with the specified 
   link identifier.  If the link identifier isn't specified, the last
   opened link is assumed.  If no link is open, the function tries to
   establish a link as if <A
HREF="function.sybase-connect.html"
><B
CLASS="function"
>sybase_connect()</B
></A
> was
   called, and use it.
  </P
><P
>&#13;   Unlike <A
HREF="function.sybase-query.html"
><B
CLASS="function"
>sybase_query()</B
></A
>,
   <B
CLASS="function"
>sybase_unbuffered_query()</B
> reads only the first
   row of the result set. <A
HREF="function.sybase-fetch-array.html"
><B
CLASS="function"
>sybase_fetch_array()</B
></A
> and similar
   function read more rows as needed.  <A
HREF="function.sybase-data-seek.html"
><B
CLASS="function"
>sybase_data_seek()</B
></A
>
   reads up to the target row.  The behavior may produce better performance
   for large result sets.
  </P
><P
>&#13;   <A
HREF="function.sybase-num-rows.html"
><B
CLASS="function"
>sybase_num_rows()</B
></A
> will only return the correct number
   of rows if all result sets have been read. To Sybase, the number of rows 
   is not known and is therefore computed by the client implementation.
  </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>注意: </B
>
    If you don't read all of the resultsets prior to executing the next query,
    PHP will raise a warning and cancel all of the pending results. To get rid of
    this, use <A
HREF="function.sybase-free-result.html"
><B
CLASS="function"
>sybase_free_result()</B
></A
> which will cancel pending 
    results of an unbuffered query.
   </P
></BLOCKQUOTE
></DIV
><P
>&#13;   The optional <CODE
CLASS="parameter"
>store_result</CODE
> can be <TT
CLASS="constant"
><B
>FALSE</B
></TT
> to indicate
   the resultsets shouldn't be fetched into memory, thus minimizing memory usage
   which is particularly interesting with very large resultsets.
  </P
><P
>&#13;   <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN233300"
></A
><P
><B
>例 1. <B
CLASS="function"
>sybase_unbuffered_query()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br /><br />$dbh </font><font color="#007700">= </font><font color="#0000BB">sybase_connect</font><font color="#007700">(</font><font color="#DD0000">'SYBASE'</font><font color="#007700">, </font><font color="#DD0000">''</font><font color="#007700">, </font><font color="#DD0000">''</font><font color="#007700">);<br /></font><font color="#0000BB">$q </font><font color="#007700">= </font><font color="#0000BB">sybase_unbuffered_query</font><font color="#007700">(</font><font color="#DD0000">'select firstname, lastname from huge_table'</font><font color="#007700">, </font><font color="#0000BB">$dbh</font><font color="#007700">, </font><font color="#0000BB">false</font><font color="#007700">);<br /></font><font color="#0000BB">sybase_data_seek</font><font color="#007700">(</font><font color="#0000BB">$q</font><font color="#007700">, </font><font color="#0000BB">10000</font><font color="#007700">);<br /></font><font color="#0000BB">$i </font><font color="#007700">= </font><font color="#0000BB">0</font><font color="#007700">;<br /><br />while (</font><font color="#0000BB">$row </font><font color="#007700">= </font><font color="#0000BB">sybase_fetch_row</font><font color="#007700">(</font><font color="#0000BB">$q</font><font color="#007700">)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#0000BB">$row</font><font color="#007700">[</font><font color="#0000BB">0</font><font color="#007700">], </font><font color="#DD0000">' '</font><font color="#007700">, </font><font color="#0000BB">$row</font><font color="#007700">[</font><font color="#0000BB">1</font><font color="#007700">], </font><font color="#DD0000">'&lt;br /&gt;'</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;if (</font><font color="#0000BB">$i</font><font color="#007700">++ &gt; </font><font color="#0000BB">40000</font><font color="#007700">) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /></font><font color="#0000BB">sybase_free_result</font><font color="#007700">(</font><font color="#0000BB">$q</font><font color="#007700">);<br /></font><font color="#0000BB">sybase_close</font><font color="#007700">(</font><font color="#0000BB">$dbh</font><font color="#007700">);<br /><br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
  </P
><P
>&#13;   See also 
   <A
HREF="function.sybase-query.html"
><B
CLASS="function"
>sybase_query()</B
></A
>.
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.sybase-set-message-handler.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="ref.tcpwrap.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>sybase_set_message_handler</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.sybase.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>TCP Wrappers Functions</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>