src/xPDO/xPDO.php
public function getConnection(array $options = array()) {
        $conn =& $this->connection;
        $mutable = $this->getOption(xPDO::OPT_CONN_MUTABLE, $options, null);
        if (!($conn instanceof xPDOConnection) || ($mutable !== null && (($mutable == true && !$conn->isMutable()) || ($mutable == false && $conn->isMutable())))) {
            if (!empty($this->_connections)) {
                shuffle($this->_connections);
                $conn = reset($this->_connections);
                while ($conn) {
                    if ($mutable !== null && (($mutable == true && !$conn->isMutable()) || ($mutable == false && $conn->isMutable()))) {
                        $conn = next($this->_connections);
                        continue;
                    }
                    $this->connection =& $conn;
                    break;
                }
            } else {
                $this->log(xPDO::LOG_LEVEL_ERROR, "Could not get a valid xPDOConnection", '', __METHOD__, __FILE__, __LINE__);
            }
        }
        return $this->connection;
    }
public function getConnection(array $options = array()) {
        $conn =& $this->connection;
        $mutable = $this->getOption(xPDO::OPT_CONN_MUTABLE, $options, null);
        if (!($conn instanceof xPDOConnection) || ($mutable !== null && (($mutable == true && !$conn->isMutable()) || ($mutable == false && $conn->isMutable())))) {
            if (!empty($this->_connections)) {
                shuffle($this->_connections);
                $conn = reset($this->_connections);
                while ($conn) {
                    if ($mutable !== null && (($mutable == true && !$conn->isMutable()) || ($mutable == false && $conn->isMutable()))) {
                        $conn = next($this->_connections);
                        continue;
                    }
                    $this->connection =& $conn;
                    break;
                }
            } else {
                $this->log(xPDO::LOG_LEVEL_ERROR, "Could not get a valid xPDOConnection", '', __METHOD__, __FILE__, __LINE__);
            }
        }
        return $this->connection;
    }
public function getConnection ( array $ options = array ( ) ) { $ conn = & $ this -> connection ; $ mutable = $ this -> getOption ( xPDO :: OPT_CONN_MUTABLE , $ options , null ) ; if ( ! ( $ conn instanceof xPDOConnection ) || ( $ mutable !== null && ( ( $ mutable == true && ! $ conn -> isMutable ( ) ) || ( $ mutable == false && $ conn -> isMutable ( ) ) ) ) ) { if ( ! empty ( $ this -> _connections ) ) { shuffle ( $ this -> _connections ) ; $ conn = reset ( $ this -> _connections ) ; while ( $ conn ) { if ( $ mutable !== null && ( ( $ mutable == true && ! $ conn -> isMutable ( ) ) || ( $ mutable == false && $ conn -> isMutable ( ) ) ) ) { $ conn = next ( $ this -> _connections ) ; continue ; } $ this -> connection = & $ conn ; break ; } } else { $ this -> log ( xPDO :: LOG_LEVEL_ERROR , "Could not get a valid xPDOConnection" , '' , __METHOD__ , __FILE__ , __LINE__ ) ; } } return $ this -> connection ; }
Get an xPDOConnection from the xPDO connection pool.

@param array $options An array of options for getting the connection.
@return xPDOConnection|null An xPDOConnection instance or null if no connection could be retrieved.
Get an xPDOConnection from the xPDO connection pool .