function execute(string $query, array $params = array()): \React\Promise\PromiseInterface {
        if($this->goingAway) {
            return \React\Promise\reject((new \Plasma\Exception('Client is closing all connections')));
        }
        
        $connection = $this->getOptimalConnection();
        
        return $connection->execute($this, $query, $params)->then(function ($value) use (&$connection) {
            $this->checkinConnection($connection);
            return $value;
        }, function (\Throwable $error) use (&$connection) {
            $this->checkinConnection($connection);
            throw $error;
        });
    }
function execute(string $query, array $params = array()): \React\Promise\PromiseInterface {
        if($this->goingAway) {
            return \React\Promise\reject((new \Plasma\Exception('Client is closing all connections')));
        }
        
        $connection = $this->getOptimalConnection();
        
        return $connection->execute($this, $query, $params)->then(function ($value) use (&$connection) {
            $this->checkinConnection($connection);
            return $value;
        }, function (\Throwable $error) use (&$connection) {
            $this->checkinConnection($connection);
            throw $error;
        });
    }
function execute ( string $ query , array $ params = array ( ) ) : \ React \ Promise \ PromiseInterface { if ( $ this -> goingAway ) { return \ React \ Promise \ reject ( ( new \ Plasma \ Exception ( 'Client is closing all connections' ) ) ) ; } $ connection = $ this -> getOptimalConnection ( ) ; return $ connection -> execute ( $ this , $ query , $ params ) -> then ( function ( $ value ) use ( & $ connection ) { $ this -> checkinConnection ( $ connection ) ; return $ value ; } , function ( \ Throwable $ error ) use ( & $ connection ) { $ this -> checkinConnection ( $ connection ) ; throw $ error ; } ) ; }
Prepares and executes a query. Resolves with a `QueryResultInterface` instance.
This is equivalent to prepare -> execute -> close.
If you need to execute a query multiple times, prepare the query manually for performance reasons.
@param string  $query
@param array   $params
@return \React\Promise\PromiseInterface
@throws \Plasma\Exception
@see \Plasma\StatementInterface
Prepares and executes a query . Resolves with a QueryResultInterface instance . This is equivalent to prepare - > execute - > close . If you need to execute a query multiple times prepare the query manually for performance reasons .