Class: Sequel::SQL::PlaceholderLiteralString

Inherits:
SpecificExpression show all
Defined in:
lib/sequel_core/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.



703
704
705
706
707
# File 'lib/sequel_core/sql.rb', line 703

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.



693
694
695
# File 'lib/sequel_core/sql.rb', line 693

def args
  @args
end

#parensObject (readonly)

Whether to surround the expression with parantheses



699
700
701
# File 'lib/sequel_core/sql.rb', line 699

def parens
  @parens
end

#strObject (readonly)

The literal string containing placeholders



696
697
698
# File 'lib/sequel_core/sql.rb', line 696

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.



711
712
713
# File 'lib/sequel_core/sql.rb', line 711

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