Quotes a literal value, if necessary, according to the DQL syntax.

@param mixed $literal The literal value.

@return string
481356
private function _quoteLiteral($literal)
    {
        if (is_numeric($literal) && !is_string($literal)) {
            return (string) $literal;
        } else if (is_bool($literal)) {
            return $literal ? "true" : "false";
        } else {
            return "'" . str_replace("'", "''", $literal) . "'";
        }
    }
600460
private function needsQuoting($target)
    {
        $isSqlFunction = strpos($target, '(') !== false || strpos($target, ')') !== false;
        $isColumn = strpos($target, '.') !== false;
        $hasQuotes = strpos($target, '`') !== false; // Whether already has quotes

        return !(is_numeric($target) || $isColumn || $isSqlFunction || $hasQuotes);
    }
1233065
public function quote(Query $query)
    {
        $binder = $query->getValueBinder();
        $query->setValueBinder(false);

        if ($query->type() === 'insert') {
            $this->_quoteInsert($query);
        } elseif ($query->type() === 'update') {
            $this->_quoteUpdate($query);
        } else {
            $this->_quoteParts($query);
        }

        $query->traverseExpressions([$this, 'quoteExpression']);
        $query->setValueBinder($binder);

        return $query;
    }
684737
protected function pregQuote($value, $delimiter = '/')
    {
        if (is_array($value) || is_object($value)) {
            foreach ($value as &$_value) {
                $_value = $this->pregQuote($_value, $delimiter);
            } // unset($_value); // Housekeeping.
            return $value;
        }
        return preg_quote((string) $value, (string) $delimiter);
    }
206866
public function quoteValue($value): string
    {
        if ($value === null) {
            return 'NULL';
        }

        $result = $this->pdo->quote($value);

        if ($result === false) {
            throw new RuntimeException('The database driver does not support quoting in this way.');
        }

        return $result;
    }
522573
protected function _quote($value)
    {
        if (is_int($value)) {
            return $value;
        } elseif (is_float($value)) {
            return sprintf('%F', $value);
        }
        return "'" . addcslashes($value, "\000\n\r\\'\"\032") . "'";
    }
761441
public function build($syntax)
	{
		$syntax->bind(is_string($this->content) ? trim($this->content) : $this->content);

		return '?';
	}
1088879
public static function quoteString(?string $value): string
  {
    if ($value===null || $value==='') return 'null';

    return "'".self::$mysqli->real_escape_string($value)."'";
  }
10464
protected function _quote($value)
    {
        if (is_int($value) || is_float($value)) {
            return $value;
        }
        $this->_connect();
        return "'" . $this->_connection->real_escape_string($value) . "'";
    }
146920
private function quoteApplicationName($s)
    {
        $quotedString = preg_replace('/ {2,}|\s/', ' ', $s);
        $quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
        $quotedString = preg_replace('/\//', '\\/', $quotedString);
        return $quotedString;
    }
165405
public function quoteString(?string $value): string
  {
    if ($value===null || $value==='') return 'null';

    return "'".$this->mysqli->real_escape_string($value)."'";
  }
41562
private function quoteValue($value)
    {
        if (is_numeric($value)) {
            return $value;
        }

        if ($value === null) {
            return 'null';
        }

        return $this->getConnection()->quote($value);
    }
1222648
private function quoteAttributeValue($s) {
	    $quotedString = $this->collapseWhitespace($s);
	    $quotedString = preg_replace('/\\\\/', '\\\\\\\\', $quotedString);
	    $quotedString = preg_replace('/\\;/', '\\;', $quotedString);
	    $quotedString = preg_replace('/\\)/', '\\)', $quotedString);
	
	    return $quotedString;
	}
717635
public static function quote($value, $empty = 'NULL')
    {
        if (is_array($value)) return '(' . join(', ', array_map(array(get_class(), 'quote'), $value)) . ')';

        if (is_null($value)) return $empty;
        if (is_bool($value)) return $value ? 'TRUE' : 'FALSE';
        if (is_int($value) || is_float($value)) return (string)$value;
        return '"' . strtr((string)$value, array('\\' => '\\\\', "\0" => '\\0', "\r" => '\\r', "\n" => '\\n', '"' => '\\"')) . '"';
    }
314252
public static function quoteDecimal($value): string
  {
    if ($value===null || $value==='') return 'null';

    if (is_int($value) || is_float($value)) return (string)$value;

    return "'".self::$mysqli->real_escape_string($value)."'";
  }
140051
public static function quoteBit(?string $bits): string
  {
    if ($bits===null || $bits==='')
    {
      return 'null';
    }

    return "b'".self::$mysqli->real_escape_string($bits)."'";
  }
1046346
public function quote($value)
    {
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                $value[$k] = $this->quote($v);
            }

            return $value;
        }
        if (is_null($value)) {
            return $value;
        }

        return $this->db->quoteValue($value);
    }