Class: Sequel::Dataset::PlaceholderLiteralizer::Argument
- Defined in:
- lib/sequel/dataset/placeholder_literalizer.rb
Overview
A placeholder argument used by the PlaceholderLiteralizer. This records the offset that the argument should be used in the resulting SQL.
Instance Method Summary collapse
-
#initialize(recorder, pos, transformer = nil) ⇒ Argument
constructor
Set the recorder, the argument position, and any transforming block to use for this placeholder.
-
#sql_literal_append(ds, sql) ⇒ Object
Record the SQL query offset, argument position, and transforming block where the argument should be literalized.
-
#transform(&block) ⇒ Object
Return a new Argument object for the same recorder and argument position, but with a different transformer block.
Constructor Details
#initialize(recorder, pos, transformer = nil) ⇒ Argument
Set the recorder, the argument position, and any transforming block to use for this placeholder.
50 51 52 53 54 55 |
# File 'lib/sequel/dataset/placeholder_literalizer.rb', line 50 def initialize(recorder, pos, transformer=nil) @recorder = recorder @pos = pos @transformer = transformer freeze end |
Instance Method Details
#sql_literal_append(ds, sql) ⇒ Object
Record the SQL query offset, argument position, and transforming block where the argument should be literalized.
59 60 61 62 63 64 65 |
# File 'lib/sequel/dataset/placeholder_literalizer.rb', line 59 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 |