static function getDatabase($link)
    {
        // Determine the database abstraction layer
        if ($link instanceof \PDO) {
            $class = 'Pdo';
        } elseif ($link instanceof \Zend\Db\Adapter\Adapter) {
            $class = 'ZendDb2';
        } elseif ($link instanceof \Zend_Db_Adapter_Abstract) {
            $class = 'ZendDb';
        } elseif ($link instanceof \MDB2_Driver_Common) {
            $class = 'Mdb2';
        } else {
            throw new \InvalidArgumentException('Unsupported link type');
        }

        // Create matching link object
        $class = "Nada\Link\\$class";
        $link = new $class($link);

        // Create and return matching database object
        $class = 'Nada\Database\\' . $link->getDbmsSuffix();
        return new $class($link);
    }
static function getDatabase($link)
    {
        // Determine the database abstraction layer
        if ($link instanceof \PDO) {
            $class = 'Pdo';
        } elseif ($link instanceof \Zend\Db\Adapter\Adapter) {
            $class = 'ZendDb2';
        } elseif ($link instanceof \Zend_Db_Adapter_Abstract) {
            $class = 'ZendDb';
        } elseif ($link instanceof \MDB2_Driver_Common) {
            $class = 'Mdb2';
        } else {
            throw new \InvalidArgumentException('Unsupported link type');
        }

        // Create matching link object
        $class = "Nada\Link\\$class";
        $link = new $class($link);

        // Create and return matching database object
        $class = 'Nada\Database\\' . $link->getDbmsSuffix();
        return new $class($link);
    }
static function getDatabase ( $ link ) { // Determine the database abstraction layer if ( $ link instanceof \ PDO ) { $ class = 'Pdo' ; } elseif ( $ link instanceof \ Zend \ Db \ Adapter \ Adapter ) { $ class = 'ZendDb2' ; } elseif ( $ link instanceof \ Zend_Db_Adapter_Abstract ) { $ class = 'ZendDb' ; } elseif ( $ link instanceof \ MDB2_Driver_Common ) { $ class = 'Mdb2' ; } else { throw new \ InvalidArgumentException ( 'Unsupported link type' ) ; } // Create matching link object $ class = "Nada\Link\\$class" ; $ link = new $ class ( $ link ) ; // Create and return matching database object $ class = 'Nada\Database\\' . $ link -> getDbmsSuffix ( ) ; return new $ class ( $ link ) ; }
Factory method to create database interface

See class description for usage example.
@param mixed $link Database link
@return \Nada\Database\AbstractDatabase NADA interface
@throws \InvalidArgumentException if no supported DBAL is detected
Factory method to create database interface