@@ -72,8 +72,8 @@ class PrefixOperator < SQLTree::Node::Expression
72
72
attr_accessor :rhs
73
73
74
74
# Generates an SQL fragment for this prefix operator expression.
75
- def to_sql
76
- "#{ operator . upcase } #{ rhs . to_sql } "
75
+ def to_sql ( options = { } )
76
+ "#{ operator . upcase } #{ rhs . to_sql ( options ) } "
77
77
end
78
78
79
79
def ==( other ) # :nodoc:
@@ -123,8 +123,8 @@ def ==(other) # :nodoc:
123
123
end
124
124
125
125
# Generates an SQL fragment for this postfix operator expression.
126
- def to_sql
127
- "#{ lhs . to_sql } #{ operator } "
126
+ def to_sql ( options = { } )
127
+ "#{ lhs . to_sql ( options ) } #{ operator } "
128
128
end
129
129
130
130
# Parses a postfix operator expression. This method is not yet implemented.
@@ -175,8 +175,8 @@ class BinaryOperator < SQLTree::Node::Expression
175
175
attr_accessor :rhs
176
176
177
177
# Generates an SQL fragment for this exression.
178
- def to_sql
179
- "(#{ lhs . to_sql } #{ operator } #{ rhs . to_sql } )"
178
+ def to_sql ( options = { } )
179
+ "(#{ lhs . to_sql ( options ) } #{ operator } #{ rhs . to_sql ( options ) } )"
180
180
end
181
181
182
182
def ==( other ) # :nodoc:
@@ -282,8 +282,8 @@ def initialize(*items)
282
282
end
283
283
284
284
# Generates an SQL fragment for this list.
285
- def to_sql
286
- "(#{ items . map { |i | i . to_sql } . join ( ', ' ) } )"
285
+ def to_sql ( options = { } )
286
+ "(#{ items . map { |i | i . to_sql ( options ) } . join ( ', ' ) } )"
287
287
end
288
288
289
289
def ==( other ) # :nodoc:
@@ -336,8 +336,8 @@ class FunctionCall < SQLTree::Node::Expression
336
336
attr_accessor :argument_list
337
337
338
338
# Generates an SQL fragment for this function call.
339
- def to_sql
340
- "#{ function } (" + argument_list . items . map { |e | e . to_sql } . join ( ', ' ) + ")"
339
+ def to_sql ( options = { } )
340
+ "#{ function } (" + argument_list . items . map { |e | e . to_sql ( options ) } . join ( ', ' ) + ")"
341
341
end
342
342
343
343
def ==( other ) # :nodoc:
@@ -383,7 +383,7 @@ def initialize(value) # :nodoc:
383
383
#
384
384
# @return [String] A correctly quoted value that can be used safely
385
385
# within an SQL query
386
- def to_sql
386
+ def to_sql ( options = { } )
387
387
case value
388
388
when nil then 'NULL'
389
389
when String then quote_str ( @value )
@@ -434,7 +434,7 @@ def initialize(name) # :nodoc:
434
434
#
435
435
# @return [String] A correctly quoted variable that can be safely
436
436
# used in SQL queries
437
- def to_sql
437
+ def to_sql ( options = { } )
438
438
quote_var ( @name )
439
439
end
440
440
@@ -481,7 +481,7 @@ def initialize(name, table = nil)
481
481
482
482
# Generates a correctly quoted reference to the field, which can
483
483
# be incorporated safely into an SQL query.
484
- def to_sql
484
+ def to_sql ( options = { } )
485
485
@table . nil? ? quote_var ( @name ) : quote_var ( @table ) + '.' + quote_var ( @name )
486
486
end
487
487
0 commit comments