Class: Sequel::SQL::PlaceholderLiteralString
- Inherits:
-
SpecificExpression
- Object
- Expression
- SpecificExpression
- Sequel::SQL::PlaceholderLiteralString
- 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
-
#args ⇒ Object
readonly
The arguments that will be subsituted into the placeholders.
-
#parens ⇒ Object
readonly
Whether to surround the expression with parantheses.
-
#str ⇒ Object
readonly
The literal string containing placeholders.
Instance Method Summary collapse
-
#initialize(str, args, parens = false) ⇒ PlaceholderLiteralString
constructor
Create an object with the given conditions and default value.
-
#to_s(ds) ⇒ Object
Delegate the creation of the resulting SQL to the given dataset, since it may be database dependent.
Methods inherited from Expression
Constructor Details
#initialize(str, args, parens = false) ⇒ PlaceholderLiteralString
Create an object with the given conditions and default value.
673 674 675 676 677 |
# File 'lib/sequel_core/sql.rb', line 673 def initialize(str, args, parens=false) @str = str @args = args @parens = parens end |
Instance Attribute Details
#args ⇒ Object (readonly)
The arguments that will be subsituted into the placeholders.
663 664 665 |
# File 'lib/sequel_core/sql.rb', line 663 def args @args end |
#parens ⇒ Object (readonly)
Whether to surround the expression with parantheses
669 670 671 |
# File 'lib/sequel_core/sql.rb', line 669 def parens @parens end |
#str ⇒ Object (readonly)
The literal string containing placeholders
666 667 668 |
# File 'lib/sequel_core/sql.rb', line 666 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.
681 682 683 |
# File 'lib/sequel_core/sql.rb', line 681 def to_s(ds) ds.placeholder_literal_string_sql(self) end |