class Sequel::SQL::PlaceholderLiteralString

  1. lib/sequel/sql.rb
Superclass: 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.


Public Class

  1. new

Public Instance

  1. args
  2. parens
  3. str
  4. with_parens


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

new (str, args, parens=false)

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

[show source]
     # File lib/sequel/sql.rb
1622 def initialize(str, args, parens=false)
1623   @str = str
1624   @args = args.is_a?(Array) && args.length == 1 && (v = args[0]).is_a?(Hash) ? v : args
1625   @parens = parens
1626   freeze
1627 end

Public Instance methods

with_parens ()

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

[show source]
     # File lib/sequel/sql.rb
1630 def with_parens
1631   @parens ? self :, @args, true)
1632 end