<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >sqlite_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="SQLite Functions" HREF="ref.sqlite.html"><LINK REL="PREVIOUS" TITLE="sqlite_udf_encode_binary" HREF="function.sqlite-udf-encode-binary.html"><LINK REL="NEXT" TITLE="sqlite_valid" HREF="function.sqlite-valid.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.sqlite-udf-encode-binary.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.sqlite-valid.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.sqlite-unbuffered-query" ></A >sqlite_unbuffered_query</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN218104" ></A ><P > (PHP 5)</P >sqlite_unbuffered_query<P > (no version information, might be only in CVS)</P >SQLiteDatabase->unbufferedQuery -- Execute a query that does not prefetch and buffer all data</DIV ><DIV CLASS="refsect1" ><A NAME="AEN218108" ></A ><H2 >说明</H2 >resource <B CLASS="methodname" >sqlite_unbuffered_query</B > ( resource dbhandle, string query [, int result_type [, string &error_msg]] )<BR ></BR >resource <B CLASS="methodname" >sqlite_unbuffered_query</B > ( string query, resource dbhandle [, int result_type [, string &error_msg]] )<BR ></BR ><P >Object oriented style (method):</P >class <B CLASS="classname" >SQLiteDatabase</B > { <BR ></BR >SQLiteUnbuffered <B CLASS="methodname" >unbufferedQuery</B > ( string query [, int result_type [, string &error_msg]] )<BR ></BR >}<P > <B CLASS="function" >sqlite_unbuffered_query()</B > is identical to <A HREF="function.sqlite-query.html" ><B CLASS="function" >sqlite_query()</B ></A > except that the result that is returned is a sequential forward-only result set that can only be used to read each row, one after the other. </P ><P > This function is ideal for generating things such as HTML tables where you only need to process one row at a time and don't need to randomly access the row data. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > Functions such as <A HREF="function.sqlite-seek.html" ><B CLASS="function" >sqlite_seek()</B ></A >, <A HREF="function.sqlite-rewind.html" ><B CLASS="function" >sqlite_rewind()</B ></A >, <A HREF="function.sqlite-next.html" ><B CLASS="function" >sqlite_next()</B ></A >, <A HREF="function.sqlite-current.html" ><B CLASS="function" >sqlite_current()</B ></A >, and <A HREF="function.sqlite-num-rows.html" ><B CLASS="function" >sqlite_num_rows()</B ></A > do not work on result handles returned from <B CLASS="function" >sqlite_unbuffered_query()</B >. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN218168" ></A ><H2 >参数</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >dbhandle</CODE ></DT ><DD ><P > The SQLite Database resource; returned from <A HREF="function.sqlite-open.html" ><B CLASS="function" >sqlite_open()</B ></A > when used procedurally. This parameter is not required when using the object-oriented method. </P ></DD ><DT ><CODE CLASS="parameter" >query</CODE ></DT ><DD ><P > The query to be executed. </P ></DD ><DT ><CODE CLASS="parameter" >result_type</CODE ></DT ><DD ><P >可选的 <CODE CLASS="parameter" >result_type</CODE > 参数接受一个常量并决定返回的数组如何索引。用 <TT CLASS="constant" ><B >SQLITE_ASSOC</B ></TT > 只会返回关联索引(有名称字段)而 <TT CLASS="constant" ><B >SQLITE_NUM</B ></TT > 只会返回数字索引(有序字段数)。<TT CLASS="constant" ><B >SQLITE_BOTH</B ></TT > 会同时返回关联和数字索引。 <TT CLASS="constant" ><B >SQLITE_BOTH</B ></TT > 是本函数的默认值。</P ></DD ><DT ><CODE CLASS="parameter" >error_msg</CODE ></DT ><DD ><P > The specified variable will be filled if an error occurs. This is specially important because SQL syntax errors can't be fetched using the <A HREF="function.sqlite-last-error.html" ><B CLASS="function" >sqlite_last_error()</B ></A > function. </P ></DD ></DL ></DIV > </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B >为兼容其它数据库(例如 MySQL),支持另两种替代的语法。推荐用第一种,<CODE CLASS="parameter" >dbhandle</CODE > 参数作为函数的第一个参数。</P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN218202" ></A ><H2 >返回值</H2 ><P > Returns a result handle or <TT CLASS="constant" ><B >FALSE</B ></TT > on failure. </P ><P > <B CLASS="function" >sqlite_unbuffered_query()</B > returns a sequential forward-only result set that can only be used to read each row, one after the other. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN218208" ></A ><H2 >更新日志</H2 ><P > <DIV CLASS="informaltable" ><P ></P ><A NAME="AEN218211" ></A ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >版本</TH ><TH >说明</TH ></TR ></THEAD ><TBODY ><TR ><TD >5.1.0</TD ><TD > Added the <CODE CLASS="parameter" >error_msg</CODE > parameter </TD ></TR ></TBODY ></TABLE ><P ></P ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN218222" ></A ><H2 >参见</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.sqlite-query.html" ><B CLASS="function" >sqlite_query()</B ></A ></TD ></TR ></TBODY ></TABLE ><P ></P > </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.sqlite-udf-encode-binary.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="function.sqlite-valid.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >sqlite_udf_encode_binary</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.sqlite.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >sqlite_valid</TD ></TR ></TABLE ></DIV ></BODY ></HTML >