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.
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
#args ⇒ Object (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 |
#parens ⇒ Object (readonly)
Whether to surround the expression with parantheses
699 700 701 |
# File 'lib/sequel_core/sql.rb', line 699 def parens @parens end |
#str ⇒ Object (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 |