class Sequel::Dataset::PlaceholderLiteralizer::Argument

  1. lib/sequel/dataset/placeholder_literalizer.rb
Superclass: Object

A placeholder argument used by the PlaceholderLiteralizer. This records the offset that the argument should be used in the resulting SQL.


Public Class

  1. new

Public Instance

  1. sql_literal_append
  2. transform

Public Class methods

new(recorder, pos, transformer=nil)

Set the recorder, the argument position, and any transforming block to use for this placeholder.

[show source]
   # File lib/sequel/dataset/placeholder_literalizer.rb
50 def initialize(recorder, pos, transformer=nil)
51   @recorder = recorder
52   @pos = pos
53   @transformer = transformer
54   freeze
55 end

Public Instance methods

sql_literal_append(ds, sql)

Record the SQL query offset, argument position, and transforming block where the argument should be literalized.

[show source]
   # File lib/sequel/dataset/placeholder_literalizer.rb
59 def sql_literal_append(ds, sql)
60   if ds.opts[:placeholder_literal_null]
61     ds.send(:literal_append, sql, nil)
62   else
63     @recorder.use(sql, @pos, @transformer)
64   end
65 end

Return a new Argument object for the same recorder and argument position, but with a different transformer block.

[show source]
   # File lib/sequel/dataset/placeholder_literalizer.rb
69 def transform(&block)
70, @pos, block)
71 end