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
172 def _sql_comment
173   specific_comment = super
174   return specific_comment if @opts[:append_sql]
175 
176   t = Sequel.current
177   hashes = db.comment_hashes
178   block_comment = if comment_hash = Sequel.synchronize{hashes[t]}
179     comment_array = comment_hash.map{|k,v| "#{k}:#{v}" unless v.nil?}
180     comment_array.compact!
181     comment_array.join(",")
182   end
183 
184   if block_comment
185     if specific_comment
186       format_sql_comment(block_comment + specific_comment)
187     else
188       format_sql_comment(block_comment)
189     end
190   else
191     specific_comment
192   end
193 end