diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-05-27 14:19:59 -0700 |
---|---|---|
committer | Bryan Helmkamp <bryan@brynary.com> | 2009-05-17 15:44:12 -0400 |
commit | 2fe585328d6a24df310d3e60059c9c7b05b64bac (patch) | |
tree | 546895f0729a612ec3e004ee08ddb1b703b43b47 /lib/arel/engines/memory/relations/operations.rb | |
parent | b7f58db57a535806e0cfc3057fbab80ca43b1a53 (diff) | |
download | rails-2fe585328d6a24df310d3e60059c9c7b05b64bac.tar.gz rails-2fe585328d6a24df310d3e60059c9c7b05b64bac.tar.bz2 rails-2fe585328d6a24df310d3e60059c9c7b05b64bac.zip |
performing in memory joins
Diffstat (limited to 'lib/arel/engines/memory/relations/operations.rb')
-rw-r--r-- | lib/arel/engines/memory/relations/operations.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/arel/engines/memory/relations/operations.rb b/lib/arel/engines/memory/relations/operations.rb index 8e03aca7b1..e35fbe3234 100644 --- a/lib/arel/engines/memory/relations/operations.rb +++ b/lib/arel/engines/memory/relations/operations.rb @@ -37,4 +37,25 @@ module Arel raise NotImplementedError end end + + class Alias < Compound + def eval + unoperated_rows + end + end + + class Join < Relation + def eval + result = [] + relation1.eval.each do |row1| + relation2.eval.each do |row2| + combined_row = row1.combine(row2, self) + if predicates.all? { |p| p.eval(combined_row) } + result << combined_row + end + end + end + result + end + end end
\ No newline at end of file |