class Sequel::Dataset::PlaceholderLiteralizer::Argument
A placeholder argument used by the PlaceholderLiteralizer. This records the offset that the argument should be used in the resulting SQL.
Public Class Methods
new(recorder, pos, transformer=nil)
click to toggle source
Set the recorder, the argument position, and any transforming block to use for this placeholder.
# File lib/sequel/dataset/placeholder_literalizer.rb, line 48 def initialize(recorder, pos, transformer=nil) @recorder = recorder @pos = pos @transformer = transformer end
Public Instance Methods
sql_literal_append(ds, sql)
click to toggle source
Record the SQL query offset, argument position, and transforming block where the argument should be literalized.
# File lib/sequel/dataset/placeholder_literalizer.rb, line 56 def sql_literal_append(ds, sql) if ds.opts[:placeholder_literal_null] ds.send(:literal_append, sql, nil) else @recorder.use(sql, @pos, @transformer) end end
transform(&block)
click to toggle source
Return a new Argument object for the same recorder and argument position, but with a different transformer block.
# File lib/sequel/dataset/placeholder_literalizer.rb, line 66 def transform(&block) Argument.new(@recorder, @pos, block) end