src/Leevel/Database/Connect.php
public function normalizeColumnValue($value, bool $quotationMark = true)
    {
        if (is_int($value)) {
            return $value;
        }

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

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

        $value = trim($value);

        // 问号占位符
        if ('[?]' === $value) {
            return '?';
        }

        // [:id] 占位符
        if (preg_match('/^\[:[a-z][a-z0-9_\-\.]*\]$/i', $value, $matches)) {
            return trim($matches[0], '[]');
        }

        if (true === $quotationMark) {
            return "'".addslashes($value)."'";
        }

        return $value;
    }
public function normalizeColumnValue($value, bool $quotationMark = true)
    {
        if (is_int($value)) {
            return $value;
        }

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

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

        $value = trim($value);

        // 问号占位符
        if ('[?]' === $value) {
            return '?';
        }

        // [:id] 占位符
        if (preg_match('/^\[:[a-z][a-z0-9_\-\.]*\]$/i', $value, $matches)) {
            return trim($matches[0], '[]');
        }

        if (true === $quotationMark) {
            return "'".addslashes($value)."'";
        }

        return $value;
    }
字段值格式化.

@param mixed $value
@param bool  $quotationMark

@return mixed