diff options
author | Bryan Helmkamp <bryan@brynary.com> | 2009-05-17 14:20:29 -0400 |
---|---|---|
committer | Bryan Helmkamp <bryan@brynary.com> | 2009-05-17 14:24:06 -0400 |
commit | bdca9ed42ffea10aa6989ea3ecebedb424fa01ed (patch) | |
tree | 80682aa1c8fe544f1e91ccb8c529e66c8a1ddc94 /lib/arel/relations/writes | |
parent | 2bbf8ca9d2af3ea959a21c3729b4894bc31f088b (diff) | |
download | rails-bdca9ed42ffea10aa6989ea3ecebedb424fa01ed.tar.gz rails-bdca9ed42ffea10aa6989ea3ecebedb424fa01ed.tar.bz2 rails-bdca9ed42ffea10aa6989ea3ecebedb424fa01ed.zip |
moved sql related code to its own engine area
Conflicts:
lib/arel/engine.rb
lib/arel/extensions/object.rb
lib/arel/predicates.rb
lib/arel/primitives/attribute.rb
lib/arel/primitives/expression.rb
lib/arel/primitives/value.rb
lib/arel/relations/operations/join.rb
lib/arel/relations/relation.rb
lib/arel/relations/utilities/externalization.rb
lib/arel/relations/utilities/nil.rb
lib/arel/relations/writes/delete.rb
lib/arel/relations/writes/insert.rb
lib/arel/relations/writes/update.rb
spec/arel/unit/relations/skip_spec.rb
spec/arel/unit/relations/take_spec.rb
spec/spec_helper.rb
Diffstat (limited to 'lib/arel/relations/writes')
-rw-r--r-- | lib/arel/relations/writes/delete.rb | 9 | ||||
-rw-r--r-- | lib/arel/relations/writes/insert.rb | 9 | ||||
-rw-r--r-- | lib/arel/relations/writes/update.rb | 11 |
3 files changed, 0 insertions, 29 deletions
diff --git a/lib/arel/relations/writes/delete.rb b/lib/arel/relations/writes/delete.rb index 0a04454e7f..a94067c7fa 100644 --- a/lib/arel/relations/writes/delete.rb +++ b/lib/arel/relations/writes/delete.rb @@ -3,15 +3,6 @@ module Arel attributes :relation deriving :initialize, :== - def to_sql(formatter = nil) - [ - "DELETE", - "FROM #{table_sql}", - ("WHERE #{wheres.collect(&:to_sql).join('\n\tAND ')}" unless wheres.blank? ), - ("LIMIT #{taken}" unless taken.blank? ), - ].compact.join("\n") - end - def call engine.delete(self) end diff --git a/lib/arel/relations/writes/insert.rb b/lib/arel/relations/writes/insert.rb index d05bd9cdc8..6d85e9769a 100644 --- a/lib/arel/relations/writes/insert.rb +++ b/lib/arel/relations/writes/insert.rb @@ -7,15 +7,6 @@ module Arel @relation, @record = relation, record.bind(relation) end - def to_sql(formatter = nil) - [ - "INSERT", - "INTO #{table_sql}", - "(#{record.keys.map { |key| engine.quote_column_name(key.name) }.join(', ')})", - "VALUES (#{record.map { |key, value| key.format(value) }.join(', ')})" - ].join("\n") - end - def call engine.create(self) end diff --git a/lib/arel/relations/writes/update.rb b/lib/arel/relations/writes/update.rb index fd0aadb479..e647218a80 100644 --- a/lib/arel/relations/writes/update.rb +++ b/lib/arel/relations/writes/update.rb @@ -7,17 +7,6 @@ module Arel @relation, @assignments = relation, assignments end - def to_sql(formatter = nil) - [ - "UPDATE #{table_sql} SET", - assignments.collect do |attribute, value| - "#{engine.quote_column_name(attribute.name)} = #{attribute.format(value)}" - end.join(",\n"), - ("WHERE #{wheres.map(&:to_sql).join('\n\tAND ')}" unless wheres.blank? ), - ("LIMIT #{taken}" unless taken.blank? ) - ].join("\n") - end - def call engine.update(self) end |