protected function quoteChars(&$query)
    {
        $checked = [];

        $chars = $this->quoteChars[$this->mode];
        if (is_array($chars)) {
            $newFrom = $chars[0];
            $newTo = $chars[1];
        } else {
            $newFrom = $chars;
            $newTo = $chars;
        }

        foreach ($this->quoteChars as $mode => $chars) {
            if ($mode == $this->mode) {
                continue;
            }

            if (is_array($chars)) {
                $oldFrom = $chars[0];
                $oldTo = $chars[1];
            } else {
                $oldFrom = $chars;
                $oldTo = $chars;
            }

            if ($oldFrom == $newFrom && $oldTo == $newTo) {
                continue;
            }

            # Create part of the regex that will represent the quoted field we are trying to find
            $match = preg_quote($oldFrom) . "([^" . preg_quote($oldTo) . "]*)" . preg_quote($oldTo);

            # If we've already checked this regex then don't check it again
            if (in_array($match, $checked, true)) {
                continue;
            }
            $checked[] = $match;

            $this->modifyQuery($query, function($part) use($match, $newFrom, $newTo) {
                return preg_replace("/" . $match . "/", $newFrom . "$1" . $newTo, $part);
            });
        }
    }