public static function sequenceNextVal($name)
    {
        $sql = null;

        switch (Driver::$name) {
        case "oracle":
            $sql = "select $name.nextval from dual";
            break;
        case "postgresql":
            $sql = "select nextval('$name') as nextval";
            break;
        }

        if ($sql == null) {
            return null;
        }

        $stmt = self::executePrepared($sql);
        $data = $stmt->fetch(\PDO::FETCH_ASSOC);
        $rtn  = null;

        if (!$data) {
            return null;
        }

        $seq_keys = array("nextval", "NEXTVAL");
        foreach ($seq_keys as $seq_key) {
            if (array_key_exists($seq_key, $data)) {
                $rtn = $data[$seq_key];
                break;
            }
        }
        return $rtn;
    }
public static function sequenceNextVal($name)
    {
        $sql = null;

        switch (Driver::$name) {
        case "oracle":
            $sql = "select $name.nextval from dual";
            break;
        case "postgresql":
            $sql = "select nextval('$name') as nextval";
            break;
        }

        if ($sql == null) {
            return null;
        }

        $stmt = self::executePrepared($sql);
        $data = $stmt->fetch(\PDO::FETCH_ASSOC);
        $rtn  = null;

        if (!$data) {
            return null;
        }

        $seq_keys = array("nextval", "NEXTVAL");
        foreach ($seq_keys as $seq_key) {
            if (array_key_exists($seq_key, $data)) {
                $rtn = $data[$seq_key];
                break;
            }
        }
        return $rtn;
    }
public static function sequenceNextVal ( $ name ) { $ sql = null ; switch ( Driver :: $ name ) { case "oracle" : $ sql = "select $name.nextval from dual" ; break ; case "postgresql" : $ sql = "select nextval('$name') as nextval" ; break ; } if ( $ sql == null ) { return null ; } $ stmt = self :: executePrepared ( $ sql ) ; $ data = $ stmt -> fetch ( \ PDO :: FETCH_ASSOC ) ; $ rtn = null ; if ( ! $ data ) { return null ; } $ seq_keys = array ( "nextval" , "NEXTVAL" ) ; foreach ( $ seq_keys as $ seq_key ) { if ( array_key_exists ( $ seq_key , $ data ) ) { $ rtn = $ data [ $ seq_key ] ; break ; } } return $ rtn ; }
Get the next value from a sequence

@param string $name sequence name

@return mixed next value
Get the next value from a sequence