module Sequel::Database::SQLComments::DatasetSQLComments

Private Instance Methods

_sql_comment() click to toggle source

Include comments added via Database#with_comments in the output SQL.

Calls superclass method Sequel::SQLComments#_sql_comment
    # File lib/sequel/extensions/sql_comments.rb
176 def _sql_comment
177   specific_comment = super
178   return specific_comment if @opts[:append_sql]
179 
180   t = Sequel.current
181   hashes = db.comment_hashes
182   block_comment = if comment_hash = Sequel.synchronize{hashes[t]}
183     comment_array = comment_hash.map{|k,v| "#{k}:#{v}" unless v.nil?}
184     comment_array.compact!
185     comment_array.join(",")
186   end
187 
188   if block_comment
189     if specific_comment
190       format_sql_comment(block_comment + specific_comment)
191     else
192       format_sql_comment(block_comment)
193     end
194   else
195     specific_comment
196   end
197 end