From 3117a5a6605fcb7c033b3ea5e074e5f087615fcf Mon Sep 17 00:00:00 2001 From: Nick Kallen Date: Thu, 3 Jan 2008 23:41:54 -0800 Subject: missing files --- lib/sql_algebra/relations/compound_relation.rb | 3 +++ lib/sql_algebra/relations/join.rb | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 lib/sql_algebra/relations/compound_relation.rb create mode 100644 lib/sql_algebra/relations/join.rb 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 -- cgit v1.2.3