DB_Common::nextId()

DB_Common::nextId() -- returns the next free id of a sequence

Synopsis

require_once 'DB.php';

resource nextId (string $seq_name, boolean $onDemand = TRUE)

Description

See "Introduction - Sequences"

Parameter

string $seq_name

name of the sequence

boolean $onDemand

when true the sequence is automatic created, if it not exists.

Return value

resource - a free id or a DB_Error, if fail

Throws

Table 20-1. Possible PEAR_Error values

Error codeError messageReasonSolution
DB_ERROR_NOT_CAPABLE null Function is not supported by the database backend Switch to another database system, if you really need this feature.
DB_ERROR_NOT_LOCKED null Locking of sequence table fails Database specific, check documention of your database,
DB_ERROR_NOSUCHTABLE null Sequence table was not found Try to create a new sequence or if you are sure, a sequence was already create, check database integrity

Note

This function can not be called statically

See

createSequence() , dropSequence()