diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-01-03 23:41:54 -0800 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-01-03 23:41:54 -0800 |
commit | 3117a5a6605fcb7c033b3ea5e074e5f087615fcf (patch) | |
tree | 96c46da7183e3696b74d7c30437fce0564f16d8a | |
parent | a5d62729799ed58ce344dba0621e951dbc92ab3f (diff) | |
download | rails-3117a5a6605fcb7c033b3ea5e074e5f087615fcf.tar.gz rails-3117a5a6605fcb7c033b3ea5e074e5f087615fcf.tar.bz2 rails-3117a5a6605fcb7c033b3ea5e074e5f087615fcf.zip |
missing files
-rw-r--r-- | lib/sql_algebra/relations/compound_relation.rb | 3 | ||||
-rw-r--r-- | lib/sql_algebra/relations/join.rb | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/sql_algebra/relations/compound_relation.rb b/lib/sql_algebra/relations/compound_relation.rb new file mode 100644 index 0000000000..a8e9a41b5e --- /dev/null +++ b/lib/sql_algebra/relations/compound_relation.rb @@ -0,0 +1,3 @@ +class CompoundRelation < Relation + delegate :attributes, :attribute, :joins, :select, :orders, :table, :to => :relation +end
\ No newline at end of file diff --git a/lib/sql_algebra/relations/join.rb b/lib/sql_algebra/relations/join.rb new file mode 100644 index 0000000000..9a6196deac --- /dev/null +++ b/lib/sql_algebra/relations/join.rb @@ -0,0 +1,15 @@ +class Join + attr_reader :relation1, :relation2, :predicates, :join_type + + def initialize(relation1, relation2, predicates, join_type) + @relation1, @relation2, @predicates, @join_type = relation1, relation2, predicates, join_type + end + + def to_sql(builder = JoinsBuilder.new) + builder.call do + send(join_type, relation2.table) do + predicates.each { |p| p.to_sql(self) } + end + end + end +end
\ No newline at end of file |