FBIRD_GEN_ID
Purpose
Use the fbird_gen_id function to generate a new,
unique sequence number from a named sequence.
Syntax
<gen_id> ::= fbird_gen_id(
gen [, inc [, conn_hndl ]] )
Element
|
Type
|
Description
|
gen
|
string
|
A valid generator (sequence) name
|
inc
|
integer
|
The increment to use, default is 1
|
conn_hndl
|
resource
|
A valid connection handle
|
<return>
|
mixed
|
Integer or string on success, False on failure
|
Semantics
The fird_gen_id function increments the named
generator (a.k.a. sequence) by the amount specified by inc and
returns the new value.
Firebird generators are always 64-bit signed
integers, regardless of the server or client platform. On 32-bit PHP
client platforms, the generated value is converted to a string if it
exceeds the limits of a 32-bit signed integer.
(This behaviour is consistent with the
ibase_fetch_*() functions, that will use strings to represent
numerical values that cannot be represented accurately using native
PHP numerical types.)
If a connection handle is not provided, then the
"default" connection will be used. The default connection
is assigned every time you call fbird_connect or fbird_pconnect, so
if you have multiple connections it will be whichever one was
connected last.
Example
The below example retrieves the next unique value
from the sequence CLIENT_ID on the current connection:
$client_id = fbird_gen_id('CLIENT_ID');
See also
N/A
|