Class Sequel::SQL::PlaceholderLiteralString
In: lib/sequel/sql.rb
Parent: GenericExpression

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

Methods

new   with_parens  

Attributes

args  [R]  The arguments that will be subsituted into the placeholders. Either an array of unnamed placeholders (which will be substituted in order for ? characters), or a hash of named placeholders (which will be substituted for :key phrases).
parens  [R]  Whether to surround the expression with parantheses
str  [R]  The literal string containing placeholders. This can also be an array of strings, where each arg in args goes between the string elements.

Public Class methods

Create an object with the given string, placeholder arguments, and parens flag.

[Source]

      # File lib/sequel/sql.rb, line 1560
1560:       def initialize(str, args, parens=false)
1561:         @str = str
1562:         @args = args.is_a?(Array) && args.length == 1 && (v = args[0]).is_a?(Hash) ? v : args
1563:         @parens = parens
1564:         freeze
1565:       end

Public Instance methods

Return a copy of the that will be surrounded by parantheses.

[Source]

      # File lib/sequel/sql.rb, line 1568
1568:       def with_parens
1569:         @parens ? self : self.class.new(@str, @args, true)
1570:       end

[Validate]