Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 | 

cubrid_unbuffered_query

Description

The cubrid_unbuffered_query() function sends a SQL query (multiple queries are not supported) to CUBRID, without fetching and buffering the result rows automatically, as cubrid_execute() 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 link_identifier.

Syntax

resource cubrid_unbuffered_query ( string $query [, int $conn_identifier ] )

  • query : A SQL query
  • link_identifier : The CUBRID connection. If the connection identifier is not specified, the last link opened by cubrid_connect() is assumed.

Note The benefits of cubrid_unbuffered_query() come at a cost: you cannot use cubrid_num_rows() and cubrid_data_seek() on a result set returned from cubrid_unbuffered_query().

Return Value
  • Returns TRUE on success, or FALSE on error.
  • For other type of SQL statements such as UPDATE, DELETE, DROP, etc, cubrid_unbuffered_query() returns TRUE on success or FALSE on error.
Example

< ?php

$result = cubrid_unbuffered_query("INSERT INTO mytable (product) values ('kossu')", $link)

if (!$result) {

echo 'Could not run query: ' .cubrid_error_msg()

exit

}

printf("Last inserted record has id %d\n", cubrid_insert_id())

?>