private function executeParallel($stmt, array $values = null): PromiseInterface
    {
        if (is_string($stmt)) {
            $stmt = $this->emulatePrepare((string) $stmt, $values);
        } else {
            if (!$stmt instanceof Statement) {
                throw new \InvalidArgumentException(sprintf('Expected %s object, got %s', Statement::class, get_class($stmt)));
            }
            if (!$stmt instanceof EmulatedStatement) {
                $stmt = $this->emulatePrepare((string) $stmt, $values ?? $stmt->getValues());
            } elseif (null !== $values) {
                $stmt = $stmt->withValues($values);
            }
        }
        try {
            // Clone connection (Mysqli Asynchronous queries require a different connection to work properly)
            $credentials = $this->getCredentials();
            $cnx         = self::createLink($credentials);
            if ($this->hasOption('charset')) {
                $cnx->set_charset($this->getOption('charset'));
            }
        } catch (mysqli_sql_exception $e) {
            throw new AccessDeniedException($e->getMessage(), (int) $e->getCode(), $e);
        }

        $stmt->bind();
        $promise = MysqliAsync::query($stmt->getRunnableQuery(), $cnx)->then(function ($result) use ($cnx, $stmt) {
            if (!$result instanceof mysqli_result) {
                $result = null;
            }
            return new Result($cnx, $result);
        });

        return $promise;
    }
private function executeParallel($stmt, array $values = null): PromiseInterface
    {
        if (is_string($stmt)) {
            $stmt = $this->emulatePrepare((string) $stmt, $values);
        } else {
            if (!$stmt instanceof Statement) {
                throw new \InvalidArgumentException(sprintf('Expected %s object, got %s', Statement::class, get_class($stmt)));
            }
            if (!$stmt instanceof EmulatedStatement) {
                $stmt = $this->emulatePrepare((string) $stmt, $values ?? $stmt->getValues());
            } elseif (null !== $values) {
                $stmt = $stmt->withValues($values);
            }
        }
        try {
            // Clone connection (Mysqli Asynchronous queries require a different connection to work properly)
            $credentials = $this->getCredentials();
            $cnx         = self::createLink($credentials);
            if ($this->hasOption('charset')) {
                $cnx->set_charset($this->getOption('charset'));
            }
        } catch (mysqli_sql_exception $e) {
            throw new AccessDeniedException($e->getMessage(), (int) $e->getCode(), $e);
        }

        $stmt->bind();
        $promise = MysqliAsync::query($stmt->getRunnableQuery(), $cnx)->then(function ($result) use ($cnx, $stmt) {
            if (!$result instanceof mysqli_result) {
                $result = null;
            }
            return new Result($cnx, $result);
        });

        return $promise;
    }
private function executeParallel ( $ stmt , array $ values = null ) : PromiseInterface { if ( is_string ( $ stmt ) ) { $ stmt = $ this -> emulatePrepare ( ( string ) $ stmt , $ values ) ; } else { if ( ! $ stmt instanceof Statement ) { throw new \ InvalidArgumentException ( sprintf ( 'Expected %s object, got %s' , Statement :: class , get_class ( $ stmt ) ) ) ; } if ( ! $ stmt instanceof EmulatedStatement ) { $ stmt = $ this -> emulatePrepare ( ( string ) $ stmt , $ values ?? $ stmt -> getValues ( ) ) ; } elseif ( null !== $ values ) { $ stmt = $ stmt -> withValues ( $ values ) ; } } try { // Clone connection (Mysqli Asynchronous queries require a different connection to work properly) $ credentials = $ this -> getCredentials ( ) ; $ cnx = self :: createLink ( $ credentials ) ; if ( $ this -> hasOption ( 'charset' ) ) { $ cnx -> set_charset ( $ this -> getOption ( 'charset' ) ) ; } } catch ( mysqli_sql_exception $ e ) { throw new AccessDeniedException ( $ e -> getMessage ( ) , ( int ) $ e -> getCode ( ) , $ e ) ; } $ stmt -> bind ( ) ; $ promise = MysqliAsync :: query ( $ stmt -> getRunnableQuery ( ) , $ cnx ) -> then ( function ( $ result ) use ( $ cnx , $ stmt ) { if ( ! $ result instanceof mysqli_result ) { $ result = null ; } return new Result ( $ cnx , $ result ) ; } ) ; return $ promise ; }
EXPERIMENTAL ! Executes a statement asynchronously.
The promise will return a Result object.

@param $stmt
@param array|null $values
@return PromiseInterface
EXPERIMENTAL ! Executes a statement asynchronously . The promise will return a Result object .