src/Service/genIdService.php
protected function getNewIdentity($conn, $dbType, $table=null, $column=null)
    {
        $dbType = strtoupper($dbType);
        if ($dbType == 'mysql' || $dbType == 'PDO_MYSQL')
        {
            $sql = "select last_insert_id()";
        }
        else if ($dbType == 'mssql' || $dbType == 'PDO_DBLIB')
            $sql = "select @@identity";
        else if ($dbType == 'sybase' || $dbType == 'PDO_DBLIB')
            $sql = "select @@identity";
        else if ($dbType == 'db2' || $dbType == 'PDO_ODBC')
            $sql = "values identity_val_local()";
        else if ($dbType == 'postgresql' || $dbType == 'PDO_PGSQL')
            $sql = "select currval('$table_$column_seq')";
        else
            throw new Exception("Error in generating new identity: unsupported database type.");
        // execute sql to get the id
        $newid = $this->_getIdWithSql($conn, $sql);
        if ($newid === false)
            throw new Exception("Error in generating new identity: unable to get a valid id.");
        return $newid;
    }
protected function getNewIdentity($conn, $dbType, $table=null, $column=null)
    {
        $dbType = strtoupper($dbType);
        if ($dbType == 'mysql' || $dbType == 'PDO_MYSQL')
        {
            $sql = "select last_insert_id()";
        }
        else if ($dbType == 'mssql' || $dbType == 'PDO_DBLIB')
            $sql = "select @@identity";
        else if ($dbType == 'sybase' || $dbType == 'PDO_DBLIB')
            $sql = "select @@identity";
        else if ($dbType == 'db2' || $dbType == 'PDO_ODBC')
            $sql = "values identity_val_local()";
        else if ($dbType == 'postgresql' || $dbType == 'PDO_PGSQL')
            $sql = "select currval('$table_$column_seq')";
        else
            throw new Exception("Error in generating new identity: unsupported database type.");
        // execute sql to get the id
        $newid = $this->_getIdWithSql($conn, $sql);
        if ($newid === false)
            throw new Exception("Error in generating new identity: unable to get a valid id.");
        return $newid;
    }
Get new Identity     *
NOTE: ID is generated after insert sql is executed

@param \Zend_Db_Adapter_Abstract $conn database connection
@param string $dbType database type
@param string $table table name
@param string $column column name
@return mixed new Id