irm-1.6-b3/MDB/pgsql.php
/**
     * returns the next free id of a sequence
     *
     * @param string  $seq_name name of the sequence
     * @param boolean $ondemand when TRUE the seqence is
     *                          automatic created, if it
     *                          not exists
     * @return mixed MDB_Error or id
     * @access public
     */
returns the next free id of a sequence
@param string  $seq_name name of the sequence
@param boolean $ondemand when TRUE the seqence is
automatic created, if it
not exists
@return mixed MDB_Error or id
@access public
returns the next free id of a sequence @param string $seq_name name of the sequence @param boolean $ondemand when TRUE the seqence is automatic created if it not exists @return mixed MDB_Error or id @access public
function nextId($seq_name, $ondemand = TRUE)
    {
        $seqname = $this->getSequenceName($seq_name);
        $repeat = 0;
        do {
            $this->pushErrorHandling(PEAR_ERROR_RETURN);
            $result = $this->query("SELECT NEXTVAL('$seqname')");
            $this->popErrorHandling();
            if ($ondemand && MDB::isError($result) && $result->getCode() == MDB_ERROR_NOSUCHTABLE) {
                $repeat = 1;
                $result = $this->createSequence($seq_name);
                if (MDB::isError($result)) {
                    return($this->raiseError($result));
                }
            } else {
                $repeat = 0;
            }
        } while ($repeat);
        if (MDB::isError($result)) {
            return($this->raiseError($result));
        }
        return($this->fetchOne($result));
    }
function nextId ( $ seq_name , $ ondemand = TRUE ) { $ seqname = $ this -> getSequenceName ( $ seq_name ) ; $ repeat = 0 ; do { $ this -> pushErrorHandling ( PEAR_ERROR_RETURN ) ; $ result = $ this -> query ( " SELECT NEXTVAL(' $ seqname ') " ) ; $ this -> popErrorHandling ( ) ; if ( $ ondemand && MDB :: isError ( $ result ) && $ result -> getCode ( ) == MDB_ERROR_NOSUCHTABLE ) { $ repeat = 1 ; $ result = $ this -> createSequence ( $ seq_name ) ; if ( MDB :: isError ( $ result ) ) { return ( $ this -> raiseError ( $ result ) ) ; } } else { $ repeat = 0 ; } } while ( $ repeat ) ; if ( MDB :: isError ( $ result ) ) { return ( $ this -> raiseError ( $ result ) ) ; } return ( $ this -> fetchOne ( $ result ) ) ; }
returns the next free id of a sequence
 @param string  $seq_name name of the sequence
 @param boolean $ondemand when TRUE the seqence is
                          automatic created, if it
                          not exists
 @return mixed MDB_Error or id
 @access public
returns the next free id of a sequence @param string $seq_name name of the sequence @param boolean $ondemand when TRUE the seqence is automatic created if it not exists @return mixed MDB_Error or id @access public