sybase_unbuffered_query
(PHP 4 >= 4.3.0, PHP 5)
sybase_unbuffered_query — Send a Sybase query and do not block
Description
$query
, resource $link_identifier
[, bool $store_result
] )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.
Note:
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.
Parameters
-
query
-
-
link_identifier
-
-
store_result
-
The optional
store_result
can beFALSE
to indicate the resultsets shouldn't be fetched into memory, thus minimizing memory usage which is particularly interesting with very large resultsets.
Return Values
Returns a positive Sybase result identifier on success, or FALSE
on
error.
Examples
Example #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[1], '<br />';
if ($i++ > 40000) {
break;
}
}
sybase_free_result($q);
sybase_close($dbh);
?>
Notes
Note: This function is only available when using the CT library interface to Sybase, and not with the DB library.
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для работы с базами данных
- Расширения для работы с базами данных отдельных производителей
- Sybase
- sybase_affected_rows
- sybase_close
- sybase_connect
- sybase_data_seek
- sybase_deadlock_retry_count
- sybase_fetch_array
- sybase_fetch_assoc
- sybase_fetch_field
- sybase_fetch_object
- sybase_fetch_row
- sybase_field_seek
- sybase_free_result
- sybase_get_last_message
- sybase_min_client_severity
- sybase_min_error_severity
- sybase_min_message_severity
- sybase_min_server_severity
- sybase_num_fields
- sybase_num_rows
- sybase_pconnect
- sybase_query
- sybase_result
- sybase_select_db
- sybase_set_message_handler
- sybase_unbuffered_query
Коментарии
404 Not Found