public function acquire( $name = 'db' )
	{
		try
		{
			$adapter = $this->_config->get( 'resource/' . $name . '/adapter', 'mysql' );

			if( !isset( $this->_connections[$name] ) || empty( $this->_connections[$name] ) )
			{
				if( !isset( $this->_count[$name] ) ) {
					$this->_count[$name] = 0;
				}

				$limit = $this->_config->get( 'resource/' . $name . '/limit', -1 );

				if( $limit >= 0 && $this->_count[$name] >= $limit ) {
					throw new MW_DB_Exception( sprintf( 'Maximum number of connections (%1$d) exceeded', $limit ) );
				}

				$this->_connections[$name] = array( $this->_createConnection( $name, $adapter ) );
				$this->_count[$name]++;
			}

			switch( $adapter )
			{
				case 'sqlite':
				case 'sqlite3':
					// SQLite uses page locking which prevents a second connection from
					// reading from tables which are already in use. Fortunately, it is
					// possible withing the same connection to do the update.
					return $this->_connections[$name][0];
			}

			return array_pop( $this->_connections[$name] );

		}
		catch( PDOException $e ) {
			throw new MW_DB_Exception( $e->getMessage(), $e->getCode(), $e->errorInfo );
		}
	}
public function acquire( $name = 'db' )
	{
		try
		{
			$adapter = $this->_config->get( 'resource/' . $name . '/adapter', 'mysql' );

			if( !isset( $this->_connections[$name] ) || empty( $this->_connections[$name] ) )
			{
				if( !isset( $this->_count[$name] ) ) {
					$this->_count[$name] = 0;
				}

				$limit = $this->_config->get( 'resource/' . $name . '/limit', -1 );

				if( $limit >= 0 && $this->_count[$name] >= $limit ) {
					throw new MW_DB_Exception( sprintf( 'Maximum number of connections (%1$d) exceeded', $limit ) );
				}

				$this->_connections[$name] = array( $this->_createConnection( $name, $adapter ) );
				$this->_count[$name]++;
			}

			switch( $adapter )
			{
				case 'sqlite':
				case 'sqlite3':
					// SQLite uses page locking which prevents a second connection from
					// reading from tables which are already in use. Fortunately, it is
					// possible withing the same connection to do the update.
					return $this->_connections[$name][0];
			}

			return array_pop( $this->_connections[$name] );

		}
		catch( PDOException $e ) {
			throw new MW_DB_Exception( $e->getMessage(), $e->getCode(), $e->errorInfo );
		}
	}
public function acquire ( $ name = 'db' ) { try { $ adapter = $ this -> _config -> get ( 'resource/' . $ name . '/adapter' , 'mysql' ) ; if ( ! isset ( $ this -> _connections [ $ name ] ) || empty ( $ this -> _connections [ $ name ] ) ) { if ( ! isset ( $ this -> _count [ $ name ] ) ) { $ this -> _count [ $ name ] = 0 ; } $ limit = $ this -> _config -> get ( 'resource/' . $ name . '/limit' , - 1 ) ; if ( $ limit >= 0 && $ this -> _count [ $ name ] >= $ limit ) { throw new MW_DB_Exception ( sprintf ( 'Maximum number of connections (%1$d) exceeded' , $ limit ) ) ; } $ this -> _connections [ $ name ] = array ( $ this -> _createConnection ( $ name , $ adapter ) ) ; $ this -> _count [ $ name ] ++ ; } switch ( $ adapter ) { case 'sqlite' : case 'sqlite3' : // SQLite uses page locking which prevents a second connection from // reading from tables which are already in use. Fortunately, it is // possible withing the same connection to do the update. return $ this -> _connections [ $ name ] [ 0 ] ; } return array_pop ( $ this -> _connections [ $ name ] ) ; } catch ( PDOException $ e ) { throw new MW_DB_Exception ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e -> errorInfo ) ; } }
Returns a database connection.

@param string $name Name of the resource in configuration
@return MW_DB_Connection_Interface
Returns a database connection .