private static function formatValue($value)
    {
        // The `$value` argument could be a number (example: 123) or a numeric
        // string (example: '123'). A numeric string is recommended for
        // 32-bit systems to prevent unexpected truncation.
        //
        // To use a numeric string in a WHERE condition, it needs to be
        // wrapped in a pair of quotes.
        // For example:
        //     SELECT Id WHERE Id = '9223372036854775807'
        if (is_numeric($value) && !is_string($value)) {
            return $value;
        }

        return sprintf('\'%s\'', addslashes($value));
    }