module Sequel::SQLComments
Public Instance Methods
Source
# File lib/sequel/extensions/sql_comments.rb 98 def comment(comment) 99 clone(:comment=>(format_sql_comment(comment) if comment)) 100 end
Return a modified copy of the dataset that will use the given comment. To uncomment a commented dataset, pass nil as the argument.
Private Instance Methods
Source
# File lib/sequel/extensions/sql_comments.rb 130 def _sql_comment 131 @opts[:comment] 132 end
The comment to include in the SQL
query, if any.
Source
# File lib/sequel/extensions/sql_comments.rb 137 def format_sql_comment(comment) 138 " -- #{comment.to_s.gsub(/\s+/, ' ')}\n" 139 end
Format the comment. For maximum compatibility, this uses a single line SQL
comment, and converts all consecutive whitespace in the comment to a single space.