diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-27 14:44:06 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-27 14:44:06 -0700 |
commit | 9b5ca7a78f53da1ba1a817041e1c78ae673887a0 (patch) | |
tree | 5f3b682dd1afce40dbf4cea51464861091ff61e4 /lib/arel | |
parent | c9d025261c14a1972bbad92796e1ba6adcc97d2b (diff) | |
download | rails-9b5ca7a78f53da1ba1a817041e1c78ae673887a0.tar.gz rails-9b5ca7a78f53da1ba1a817041e1c78ae673887a0.tar.bz2 rails-9b5ca7a78f53da1ba1a817041e1c78ae673887a0.zip |
PERF: avoiding more method missing
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? |