protected function getNewGUID($conn, $dbType, $table=null, $column=null)
    {
        $dbType = strtoupper($dbType);
        if ($dbType == 'mysql' || $dbType == 'PDO_DBLIB')
            $sql = "select uuid()";
        else if ($dbType == 'oracle' || $dbType == 'oci8' || $dbType == 'PDO_OCI')
            $sql = "select rawtohex(sys_guid()) from dual";
        else if ($dbType == 'msql' || $dbType == 'PDO_MYSQL')
            $sql = "select newid()";
        else
            throw new Exception("Error in generating new GUID: unsupported database type.");
        // execute sql to get the id
        $newId = $this->_getIdWithSql($conn, $sql);
        if ($newId === false)
            throw new Exception("Error in generating new GUID: unable to get a valid id.");
        return $newId;
    }
protected function getNewGUID($conn, $dbType, $table=null, $column=null)
    {
        $dbType = strtoupper($dbType);
        if ($dbType == 'mysql' || $dbType == 'PDO_DBLIB')
            $sql = "select uuid()";
        else if ($dbType == 'oracle' || $dbType == 'oci8' || $dbType == 'PDO_OCI')
            $sql = "select rawtohex(sys_guid()) from dual";
        else if ($dbType == 'msql' || $dbType == 'PDO_MYSQL')
            $sql = "select newid()";
        else
            throw new Exception("Error in generating new GUID: unsupported database type.");
        // execute sql to get the id
        $newId = $this->_getIdWithSql($conn, $sql);
        if ($newId === false)
            throw new Exception("Error in generating new GUID: unable to get a valid id.");
        return $newId;
    }
protected function getNewGUID ( $ conn , $ dbType , $ table = null , $ column = null ) { $ dbType = strtoupper ( $ dbType ) ; if ( $ dbType == 'mysql' || $ dbType == 'PDO_DBLIB' ) $ sql = "select uuid()" ; else if ( $ dbType == 'oracle' || $ dbType == 'oci8' || $ dbType == 'PDO_OCI' ) $ sql = "select rawtohex(sys_guid()) from dual" ; else if ( $ dbType == 'msql' || $ dbType == 'PDO_MYSQL' ) $ sql = "select newid()" ; else throw new Exception ( "Error in generating new GUID: unsupported database type." ) ; // execute sql to get the id $ newId = $ this -> _getIdWithSql ( $ conn , $ sql ) ; if ( $ newId === false ) throw new Exception ( "Error in generating new GUID: unable to get a valid id." ) ; return $ newId ; }
Get new GUID
ID is generated before executing insert sql

@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
Get new GUID ID is generated before executing insert sql