diff options
Diffstat (limited to 'lib/arel')
-rw-r--r-- | lib/arel/engines/sql/formatters.rb | 23 | ||||
-rw-r--r-- | lib/arel/engines/sql/relations/compiler.rb | 2 |
2 files changed, 21 insertions, 4 deletions
diff --git a/lib/arel/engines/sql/formatters.rb b/lib/arel/engines/sql/formatters.rb index de8278479d..2597beba95 100644 --- a/lib/arel/engines/sql/formatters.rb +++ b/lib/arel/engines/sql/formatters.rb @@ -2,14 +2,31 @@ module Arel module Sql class Formatter attr_reader :environment, :christener - delegate :engine, :to => :environment - delegate :name_for, :to => :christener - delegate :quote_table_name, :quote_column_name, :quote, :to => :engine def initialize(environment) @environment = environment @christener = environment.christener end + + def name_for thing + @christener.name_for thing + end + + def engine + @environment.engine + end + + def quote_column_name name + engine.connection.quote_column_name name + end + + def quote_table_name name + engine.connection.quote_column_name name + end + + def quote value, column = nil + engine.connection.quote value, column + end end class SelectClause < Formatter diff --git a/lib/arel/engines/sql/relations/compiler.rb b/lib/arel/engines/sql/relations/compiler.rb index 05a071b4bf..2941fc2a06 100644 --- a/lib/arel/engines/sql/relations/compiler.rb +++ b/lib/arel/engines/sql/relations/compiler.rb @@ -40,7 +40,7 @@ module Arel offset = relation.skipped limit = relation.taken - @engine.add_limit_offset!(clauses, :limit => limit, + @engine.connection.add_limit_offset!(clauses, :limit => limit, :offset => offset) if offset || limit clauses << " #{locked}" unless locked.blank? |