Class: Sequel::SQL::PlaceholderLiteralString

Inherits:
Expression show all
Defined in:
lib/sequel/sql.rb

Overview

Represents a literal string with placeholders and arguments. This is necessary to ensure delayed literalization of the arguments required for the prepared statement support

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Expression

#lit

Constructor Details

#initialize(str, args, parens = false) ⇒ PlaceholderLiteralString

Create an object with the given conditions and default value.



669
670
671
672
673
# File 'lib/sequel/sql.rb', line 669

def initialize(str, args, parens=false)
  @str = str
  @args = args
  @parens = parens
end

Instance Attribute Details

#argsObject (readonly)

The arguments that will be subsituted into the placeholders.



659
660
661
# File 'lib/sequel/sql.rb', line 659

def args
  @args
end

#parensObject (readonly)

Whether to surround the expression with parantheses



665
666
667
# File 'lib/sequel/sql.rb', line 665

def parens
  @parens
end

#strObject (readonly)

The literal string containing placeholders



662
663
664
# File 'lib/sequel/sql.rb', line 662

def str
  @str
end

Instance Method Details

#to_s(ds) ⇒ Object

Delegate the creation of the resulting SQL to the given dataset, since it may be database dependent.



677
678
679
# File 'lib/sequel/sql.rb', line 677

def to_s(ds)
  ds.placeholder_literal_string_sql(self)
end