diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-26 14:29:21 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-26 14:29:21 -0700 |
commit | 82e0b8dd85a82fc9907f96bb1af849453a87b01a (patch) | |
tree | e4cac8ab6008bda91e6564ebdcb8a02b9162a839 /lib | |
parent | d2092e7e0bb5260bd02d9eeea4decf7efa34e29c (diff) | |
download | rails-82e0b8dd85a82fc9907f96bb1af849453a87b01a.tar.gz rails-82e0b8dd85a82fc9907f96bb1af849453a87b01a.tar.bz2 rails-82e0b8dd85a82fc9907f96bb1af849453a87b01a.zip |
reorganizing more classes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/algebra/relations/writes.rb | 16 | ||||
-rw-r--r-- | lib/arel/engines/memory/relations.rb | 2 | ||||
-rw-r--r-- | lib/arel/engines/memory/relations/writes.rb | 7 | ||||
-rw-r--r-- | lib/arel/engines/sql/relations.rb | 1 | ||||
-rw-r--r-- | lib/arel/engines/sql/relations/writes.rb | 19 |
5 files changed, 16 insertions, 29 deletions
diff --git a/lib/arel/algebra/relations/writes.rb b/lib/arel/algebra/relations/writes.rb index 17da2b172b..8cf7a7cdad 100644 --- a/lib/arel/algebra/relations/writes.rb +++ b/lib/arel/algebra/relations/writes.rb @@ -9,6 +9,10 @@ module Arel def call engine.delete(self) end + + def to_sql + compiler.delete_sql + end end class Insert < Action @@ -26,6 +30,14 @@ module Arel def == other super && @record == other.record end + + def eval + unoperated_rows + [Row.new(self, record.values.collect(&:value))] + end + + def to_sql(include_returning = true) + compiler.insert_sql(include_returning) + end end class Update < Insert @@ -34,5 +46,9 @@ module Arel def call engine.update(self) end + + def to_sql + compiler.update_sql + end end end diff --git a/lib/arel/engines/memory/relations.rb b/lib/arel/engines/memory/relations.rb index 2ab56adb3b..046017d78a 100644 --- a/lib/arel/engines/memory/relations.rb +++ b/lib/arel/engines/memory/relations.rb @@ -1,4 +1,2 @@ require 'arel/engines/memory/relations/array' require 'arel/engines/memory/relations/operations' -require 'arel/engines/memory/relations/writes' - diff --git a/lib/arel/engines/memory/relations/writes.rb b/lib/arel/engines/memory/relations/writes.rb deleted file mode 100644 index 39c1170ddc..0000000000 --- a/lib/arel/engines/memory/relations/writes.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Arel - class Insert < Action - def eval - unoperated_rows + [Row.new(self, record.values.collect(&:value))] - end - end -end diff --git a/lib/arel/engines/sql/relations.rb b/lib/arel/engines/sql/relations.rb index 1dea1423b8..b6098a6e42 100644 --- a/lib/arel/engines/sql/relations.rb +++ b/lib/arel/engines/sql/relations.rb @@ -5,4 +5,3 @@ require 'arel/engines/sql/relations/utilities/nil' require 'arel/engines/sql/relations/compiler' require 'arel/engines/sql/relations/table' require 'arel/engines/sql/relations/operations/join' -require 'arel/engines/sql/relations/writes' diff --git a/lib/arel/engines/sql/relations/writes.rb b/lib/arel/engines/sql/relations/writes.rb deleted file mode 100644 index 50a2ce2e99..0000000000 --- a/lib/arel/engines/sql/relations/writes.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Arel - class Deletion < Action - def to_sql - compiler.delete_sql - end - end - - class Insert < Action - def to_sql(include_returning = true) - compiler.insert_sql(include_returning) - end - end - - class Update < Insert - def to_sql - compiler.update_sql - end - end -end |