Description
resource
sybase_unbuffered_query ( string query, resource link_identifier)
Returns a positive Sybase result identifier on success, or
FALSE on error_
sybase_unbuffered_query() 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 sybase_connect() was
called, and use it_
Unlike sybase_query(),
sybase_unbuffered_query() reads only the first
row of the result set_ sybase_fetch_array() and similar
function read more rows as needed_ sybase_data_seek()
reads up to the target row_ The behavior may produce better performance
for large result sets_
sybase_num_rows() 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_
Nota:
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 sybase_free_result() which will cancel pending
results of an unbuffered query_
The optional store_result can be FALSE to indicate
the resultsets should'nt be fetched into memory, thus minimizing memory usage
which is particularily interesting with very large resultsets_
Ejemplo 1_ sybase_unbuffered_query() example <?php
$dbh= sybase_connect('SYBASE', '', '');
$q= sybase_unbuffered_query('select firstname, lastname from huge_table', $dbh, FALSE);
sybase_data_seek($q, 10000);
$i= 0;
while ($row= sybase_fetch_row($q)) {
echo $row[0]_' '_$row[0];
if ($i++ > 40000) break;
}
sybase_free_result($q);
sybase_close($dbh);
?> |
|