method

sanitize_as_sql_comment

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActiveRecord::ConnectionAdapters::Quoting
sanitize_as_sql_comment(value) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/abstract/quoting.rb, line 167
      def sanitize_as_sql_comment(value) # :nodoc:
        # Sanitize a string to appear within a SQL comment
        # For compatibility, this also surrounding "/*+", "/*", and "*/"
        # charcacters, possibly with single surrounding space.
        # Then follows that by replacing any internal "*/" or "/ *" with
        # "* /" or "/ *"
        comment = value.to_s.dup
        comment.gsub!(%{\A\s*/\*\+?\s?|\s?\*/\s*\Z}, "")
        comment.gsub!("*/", "* /")
        comment.gsub!("/*", "/ *")
        comment
      end
Register or log in to add new notes.