<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<refentry xml:id="function.mysql-unbuffered-query" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>mysql_unbuffered_query</refname>
  <refpurpose>Send an SQL query to MySQL, without fetching and buffering the result rows</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>resource</type><methodname>mysql_unbuffered_query</methodname>
   <methodparam><type>string</type><parameter>query</parameter></methodparam>
   <methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>mysql_unbuffered_query</function> sends a SQL query
   <parameter>query</parameter> to MySQL, without fetching and
   buffering the result rows automatically, as
   <function>mysql_query</function> does.  On the one hand, this
   saves a considerable amount of memory with SQL queries that
   produce large result sets. On the other hand, you can start
   working on the result set immediately after the first row has
   been retrieved: you don't have to wait until the complete SQL
   query has been performed.  When using multiple DB-connects, you
   have to specify the optional parameter
   <parameter>link_identifier</parameter>.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>query</parameter></term>
     <listitem>
      <para>
       A SQL query
      </para>
     </listitem>
    </varlistentry>
    &mysql.linkid.description;
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   For SELECT, SHOW, DESCRIBE or EXPLAIN statements,
   <function>mysql_unbuffered_query</function> 
   returns a <type>resource</type> on success, or &false; on
   error.
  </para>
  <para>
   For other type of SQL statements, UPDATE, DELETE, DROP, etc,
   <function>mysql_unbuffered_query</function> returns &true; on success
   or &false; on error.
  </para>
 </refsect1>

 <refsect1 role="notes">
  &reftitle.notes;
  <note>
   <para>
    The benefits of <function>mysql_unbuffered_query</function> come
    at a cost: You cannot use <function>mysql_num_rows</function> and
    <function>mysql_data_seek</function> on a result set returned from
    <function>mysql_unbuffered_query</function>. You also have to
    fetch all result rows from an unbuffered SQL query, before you
    can send a new SQL query to MySQL.
   </para>
  </note>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>mysql_query</function></member>
   </simplelist>
  </para>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->