method
escape_sql_comment
v7.1.3.2 -
Show latest stable
- Class:
ActiveRecord::QueryLogs
escape_sql_comment(content)private
No documentation available.
# File activerecord/lib/active_record/query_logs.rb, line 136
def escape_sql_comment(content)
# Sanitize a string to appear within a SQL comment
# For compatibility, this also surrounding "/*+", "/*", and "*/"
# characters, possibly with single surrounding space.
# Then follows that by replacing any internal "*/" or "/ *" with
# "* /" or "/ *"
comment = content.to_s.dup
comment.gsub!(%{\A\s*/\*\+?\s?|\s?\*/\s*\Z}, "")
comment.gsub!("*/", "* /")
comment.gsub!("/*", "/ *")
comment
end