src/Service/genIdService.php
protected function getNewSequence($conn, $dbtype, $sequenceName)
    {
        $dbtype = strtoupper($dbtype);
        if ($dbtype == 'oracle' || $dbtype == 'oci8' || $dbtype == 'PDO_OCI')
            $sql = "select $sequenceName.nextval from dual";
        else if ($dbtype == 'db2' || $dbtype == 'PDO_ODBC')
            $sql = "values nextval for $sequenceName";
        else if ($dbtype == 'postgresql' || $dbtype == 'PDO_PGSQL')
            $sql = "select nextval('$sequenceName')";
        else if ($dbtype == 'informix' || $dbtype == 'PDO_INFORMIX')
            "select $sequenceName.nextval from systables where tabid=1";
        else
            throw new Exception("Error in generating new sequence: unsupported database type.");
        // execute sql to get the id
        $newId = $this->_getIdWithSql($conn, $sql);
        if ($newId === false)
            throw new Exception("Error in generating new sequence: unable to get a valid id.");
        return $newId;
    }
protected function getNewSequence($conn, $dbtype, $sequenceName)
    {
        $dbtype = strtoupper($dbtype);
        if ($dbtype == 'oracle' || $dbtype == 'oci8' || $dbtype == 'PDO_OCI')
            $sql = "select $sequenceName.nextval from dual";
        else if ($dbtype == 'db2' || $dbtype == 'PDO_ODBC')
            $sql = "values nextval for $sequenceName";
        else if ($dbtype == 'postgresql' || $dbtype == 'PDO_PGSQL')
            $sql = "select nextval('$sequenceName')";
        else if ($dbtype == 'informix' || $dbtype == 'PDO_INFORMIX')
            "select $sequenceName.nextval from systables where tabid=1";
        else
            throw new Exception("Error in generating new sequence: unsupported database type.");
        // execute sql to get the id
        $newId = $this->_getIdWithSql($conn, $sql);
        if ($newId === false)
            throw new Exception("Error in generating new sequence: unable to get a valid id.");
        return $newId;
    }
Get new sequence
NOTE: // ID is generated before executing insert sql

@param \Zend_Db_Adapter_Abstract $conn database connection
@param string $dbType database type
@param string $sequenceName
@return mixed