Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 6249

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Send a Sybase query and do not block</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sybase-set-message-handler.html">sybase_set_message_handler</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.tokyo-tyrant.html">tokyo_tyrant</a></div>
 <div class="up"><a href="ref.sybase.html">Sybase Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.sybase-unbuffered-query" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sybase_unbuffered_query</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5)</p><p class="refpurpose"><span class="refname">sybase_unbuffered_query</span> &mdash; <span class="dc-title">Send a Sybase query and do not block</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.sybase-unbuffered-query-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>sybase_unbuffered_query</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
   , <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link_identifier</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$store_result</code></span>
  ] )</div>

  <p class="para rdfs-comment">
    <span class="function"><strong>sybase_unbuffered_query()</strong></span> sends a query to the
   currently active database on the server that&#039;s associated with the specified
   link identifier.  If the link identifier isn&#039;t specified, the last
   opened link is assumed.  If no link is open, the function tries to
   establish a link as if  <span class="function"><a href="function.sybase-connect.html" class="function">sybase_connect()</a></span> was
   called, and use it.
  </p>
  <p class="para">
   Unlike  <span class="function"><a href="function.sybase-query.html" class="function">sybase_query()</a></span>,
    <span class="function"><strong>sybase_unbuffered_query()</strong></span> reads only the first
   row of the result set.  <span class="function"><a href="function.sybase-fetch-array.html" class="function">sybase_fetch_array()</a></span> and similar
   function read more rows as needed.   <span class="function"><a href="function.sybase-data-seek.html" class="function">sybase_data_seek()</a></span>
   reads up to the target row.  The behavior may produce better performance
   for large result sets.
  </p>
  <p class="para">
    <span class="function"><a href="function.sybase-num-rows.html" class="function">sybase_num_rows()</a></span> 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>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    If you don&#039;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  <span class="function"><a href="function.sybase-free-result.html" class="function">sybase_free_result()</a></span> which will cancel pending
    results of an unbuffered query.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.sybase-unbuffered-query-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">query</code></em></span>
     <dd>

      <p class="para">
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">link_identifier</code></em></span>
     <dd>

      <p class="para">
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">store_result</code></em></span>
     <dd>

      <p class="para">
       The optional <em><code class="parameter">store_result</code></em> can be <strong><code>FALSE</code></strong> to
       indicate the resultsets shouldn&#039;t be fetched into memory, thus
       minimizing memory usage which is particularly interesting with very
       large resultsets.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.sybase-unbuffered-query-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns a positive Sybase result identifier on success, or <strong><code>FALSE</code></strong> on
   error.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.sybase-unbuffered-query-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-2201">
    <p><strong>Example #1  <span class="function"><strong>sybase_unbuffered_query()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$dbh&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sybase_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'SYBASE'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$q&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sybase_unbuffered_query</span><span style="color: #007700">(</span><span style="color: #DD0000">'select&nbsp;firstname,&nbsp;lastname&nbsp;from&nbsp;huge_table'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">sybase_data_seek</span><span style="color: #007700">(</span><span style="color: #0000BB">$q</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">10000</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /><br />while&nbsp;(</span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">sybase_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$q</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">],&nbsp;</span><span style="color: #DD0000">'&nbsp;'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">],&nbsp;</span><span style="color: #DD0000">'&lt;br&nbsp;/&gt;'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$i</span><span style="color: #007700">++&nbsp;&gt;&nbsp;</span><span style="color: #0000BB">40000</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: #0000BB">sybase_free_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$q</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">sybase_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbh</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.sybase-unbuffered-query-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">This function is only available when
using the CT library interface to Sybase, and not with the DB library.
</span></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.sybase-unbuffered-query-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.sybase-query.html" class="function" rel="rdfs-seeAlso">sybase_query()</a> - Sends a Sybase query</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sybase-set-message-handler.html">sybase_set_message_handler</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.tokyo-tyrant.html">tokyo_tyrant</a></div>
 <div class="up"><a href="ref.sybase.html">Sybase Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>