PHP Doku:: Increments the named generator and returns its new value - function.ibase-gen-id.html

Verlauf / Chronik / History: (12) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenFirebird/InterBaseFirebird/InterBase Funktionenibase_gen_id

Ein Service von Reinhard Neidl - Webprogrammierung.

Firebird/InterBase Funktionen

<<ibase_free_result

ibase_maintain_db>>

ibase_gen_id

(PHP 5)

ibase_gen_idIncrements the named generator and returns its new value

Beschreibung

mixed ibase_gen_id ( string $generator [, int $increment = 1 [, resource $link_identifier = NULL ]] )
Warnung

Diese Funktion ist bis jetzt nicht dokumentiert. Es steht nur die Liste der Argumente zur Verfügung.

Rückgabewerte

Returns new generator value as integer, or as string if the value is too big.


3 BenutzerBeiträge:
- Beiträge aktualisieren...
robert
12.12.2006 8:24
EXAMPLE:
You need to know the generator´s value after INSERT:

Before INSERT-Statement run

$nextnumber=ibase_gen_id ("GEN_NAME",1);

GEN_NAME: is the generator´s name

1: means add 1 to actual value of generator

$nextnumber: is variable to store generators value after incrementing

In the INSERT-Statement you can use $nextnumber instead of using generator directly like in:
INSERT INTO test (field1, field2) VALUES gen_id(gen_test_id, 1), 'testme');
escoric at latinmail dot com
17.08.2004 19:00
$sql="INSERT INTO mitabla(campo1,campo2,..campo n) VALUES(GEN_ID(mitabla1_codigo_gen,1),'contenido 1', 'contenido 2', 'contenido n' )";
mfischer at php dot net
28.04.2004 13:54
Question arose on php-dev:

How does ibase_gen_id() handle 64bit values?

Interbase 6/Firebird generators are always 64-bit signed integers
(Firebird's BIGINT type), regardless of the platform the client is
running.
On 64-bit platforms, this will never require conversion as PHP's int
type is 64 bits wide on those platforms. On 32-bit 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.)

[Edited by PHP/Interbase maintainer.]



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)