Firebird 2.0
PHP5 Programming
Manual

FBIRD_NAME_RESULT

Purpose

Use the fbird_name_result function to name a result set.

Syntax

<name_result> ::=
   fbird_name_result( res_hndl, name )


Element 
Type
Description
res_hndl
resource
A valid result set handle
name
string
Name of the result set
<return>
bool
True on success, False on failure

Semantics

The fbird_name_result function assigns a name to a result set. The name can be up to 31 characters in length. You can only name result sets that orginate from SELECT statements that include the FOR UPDATE clause.

During the fetch of a result set, the name can be used in UPDATE and DELETE statements: by using the “WHERE CURRENT OF name” clause limits those statements to the row last fetched, i.e. the current row.

This function returns True on success or False on failure.

Example

The below example code fragment names a result set and updates each row as it is fetched:

$res = fbird_query("SELECT field1,field2 FROM table FOR UPDATE");
fbird_name_result($res, "my_cursor");

$sql = "UPDATE table SET field2 = ? WHERE CURRENT OF my_cursor";
$updateqry = fbird_prepare($sql);

for ($i = 0; fbird_fetch_row($res); ++$i) {
   fbird_execute($updateqry, $i);
}



See also

fbird_execute, fbird_query


previous page goto index next page

Legal information