lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
private function setDriverOptions(array $driverOptions = [])
    {
        $supportedDriverOptions = [
            MYSQLI_OPT_CONNECT_TIMEOUT,
            MYSQLI_OPT_LOCAL_INFILE,
            MYSQLI_INIT_COMMAND,
            MYSQLI_READ_DEFAULT_FILE,
            MYSQLI_READ_DEFAULT_GROUP,
        ];

        if (defined('MYSQLI_SERVER_PUBLIC_KEY')) {
            $supportedDriverOptions[] = MYSQLI_SERVER_PUBLIC_KEY;
        }

        $exceptionMsg = "%s option '%s' with value '%s'";

        foreach ($driverOptions as $option => $value) {
            if ($option === static::OPTION_FLAGS) {
                continue;
            }

            if (! in_array($option, $supportedDriverOptions, true)) {
                throw new MysqliException(
                    sprintf($exceptionMsg, 'Unsupported', $option, $value)
                );
            }

            if (@mysqli_options($this->conn, $option, $value)) {
                continue;
            }

            $msg  = sprintf($exceptionMsg, 'Failed to set', $option, $value);
            $msg .= sprintf(', error: %s (%d)', mysqli_error($this->conn), mysqli_errno($this->conn));

            throw new MysqliException(
                $msg,
                $this->conn->sqlstate,
                $this->conn->errno
            );
        }
    }
private function setDriverOptions(array $driverOptions = [])
    {
        $supportedDriverOptions = [
            MYSQLI_OPT_CONNECT_TIMEOUT,
            MYSQLI_OPT_LOCAL_INFILE,
            MYSQLI_INIT_COMMAND,
            MYSQLI_READ_DEFAULT_FILE,
            MYSQLI_READ_DEFAULT_GROUP,
        ];

        if (defined('MYSQLI_SERVER_PUBLIC_KEY')) {
            $supportedDriverOptions[] = MYSQLI_SERVER_PUBLIC_KEY;
        }

        $exceptionMsg = "%s option '%s' with value '%s'";

        foreach ($driverOptions as $option => $value) {
            if ($option === static::OPTION_FLAGS) {
                continue;
            }

            if (! in_array($option, $supportedDriverOptions, true)) {
                throw new MysqliException(
                    sprintf($exceptionMsg, 'Unsupported', $option, $value)
                );
            }

            if (@mysqli_options($this->conn, $option, $value)) {
                continue;
            }

            $msg  = sprintf($exceptionMsg, 'Failed to set', $option, $value);
            $msg .= sprintf(', error: %s (%d)', mysqli_error($this->conn), mysqli_errno($this->conn));

            throw new MysqliException(
                $msg,
                $this->conn->sqlstate,
                $this->conn->errno
            );
        }
    }
private function setDriverOptions ( array $ driverOptions = [ ] ) { $ supportedDriverOptions = [ MYSQLI_OPT_CONNECT_TIMEOUT , MYSQLI_OPT_LOCAL_INFILE , MYSQLI_INIT_COMMAND , MYSQLI_READ_DEFAULT_FILE , MYSQLI_READ_DEFAULT_GROUP , ] ; if ( defined ( 'MYSQLI_SERVER_PUBLIC_KEY' ) ) { $ supportedDriverOptions [ ] = MYSQLI_SERVER_PUBLIC_KEY ; } $ exceptionMsg = "%s option '%s' with value '%s'" ; foreach ( $ driverOptions as $ option => $ value ) { if ( $ option === static :: OPTION_FLAGS ) { continue ; } if ( ! in_array ( $ option , $ supportedDriverOptions , true ) ) { throw new MysqliException ( sprintf ( $ exceptionMsg , 'Unsupported' , $ option , $ value ) ) ; } if ( @ mysqli_options ( $ this -> conn , $ option , $ value ) ) { continue ; } $ msg = sprintf ( $ exceptionMsg , 'Failed to set' , $ option , $ value ) ; $ msg .= sprintf ( ', error: %s (%d)' , mysqli_error ( $ this -> conn ) , mysqli_errno ( $ this -> conn ) ) ; throw new MysqliException ( $ msg , $ this -> conn -> sqlstate , $ this -> conn -> errno ) ; } }
Apply the driver options to the connection.

@param mixed[] $driverOptions

@throws MysqliException When one of of the options is not supported.
@throws MysqliException When applying doesn't work - e.g. due to incorrect value.
Apply the driver options to the connection .