private function prepareDB()
    {
        $dbpool = DBPool::init($this->db_config);
        // var_dump($dbpool->cap + $dbpool->activeCount, $dbpool->queue->isEmpty(), $dbpool->queue->count());

        if ($dbpool->queue->isEmpty() && ($dbpool->cap + $dbpool->activeCount >= $this->config['max_pool_size'])) {
            \throw_error('MySQL pool is empty...', 12009);
        }

        if ($dbpool->cap < $this->config['idle_pool_size']
            || ($dbpool->queue->isEmpty() && $dbpool->cap < $this->config['max_pool_size'])
        ) {
            // var_dump('........................reconnect........................');
            $this->reconnect();
            $dbpool->activeCount++;
            return false;
        } else {
            // var_dump('........................using pool........................');
            $this->db = $dbpool->out($this->config['idle_pool_size']);
            return true;
        }
    }
private function prepareDB()
    {
        $dbpool = DBPool::init($this->db_config);
        // var_dump($dbpool->cap + $dbpool->activeCount, $dbpool->queue->isEmpty(), $dbpool->queue->count());

        if ($dbpool->queue->isEmpty() && ($dbpool->cap + $dbpool->activeCount >= $this->config['max_pool_size'])) {
            \throw_error('MySQL pool is empty...', 12009);
        }

        if ($dbpool->cap < $this->config['idle_pool_size']
            || ($dbpool->queue->isEmpty() && $dbpool->cap < $this->config['max_pool_size'])
        ) {
            // var_dump('........................reconnect........................');
            $this->reconnect();
            $dbpool->activeCount++;
            return false;
        } else {
            // var_dump('........................using pool........................');
            $this->db = $dbpool->out($this->config['idle_pool_size']);
            return true;
        }
    }
private function prepareDB ( ) { $ dbpool = DBPool :: init ( $ this -> db_config ) ; // var_dump($dbpool->cap + $dbpool->activeCount, $dbpool->queue->isEmpty(), $dbpool->queue->count()); if ( $ dbpool -> queue -> isEmpty ( ) && ( $ dbpool -> cap + $ dbpool -> activeCount >= $ this -> config [ 'max_pool_size' ] ) ) { \ throw_error ( 'MySQL pool is empty...' , 12009 ) ; } if ( $ dbpool -> cap < $ this -> config [ 'idle_pool_size' ] || ( $ dbpool -> queue -> isEmpty ( ) && $ dbpool -> cap < $ this -> config [ 'max_pool_size' ] ) ) { // var_dump('........................reconnect........................'); $ this -> reconnect ( ) ; $ dbpool -> activeCount ++ ; return false ; } else { // var_dump('........................using pool........................'); $ this -> db = $ dbpool -> out ( $ this -> config [ 'idle_pool_size' ] ) ; return true ; } }
Get one MySQL connect from pool

@return bool
Get one MySQL connect from pool