aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/engines
diff options
context:
space:
mode:
authorBryan Helmkamp <bryan@brynary.com>2009-05-17 14:49:56 -0400
committerBryan Helmkamp <bryan@brynary.com>2009-05-17 14:49:56 -0400
commit3a6e8e5a3f99841691b70b89b0a10f836e6ec071 (patch)
tree89e59775b729616ca9cb4a4f1f70415af35ce3d7 /lib/arel/engines
parent892337509b2bd269920dc567bc48c6a28c7222d2 (diff)
downloadrails-3a6e8e5a3f99841691b70b89b0a10f836e6ec071.tar.gz
rails-3a6e8e5a3f99841691b70b89b0a10f836e6ec071.tar.bz2
rails-3a6e8e5a3f99841691b70b89b0a10f836e6ec071.zip
join sql stuff moved into sql adapter
Conflicts: lib/arel/algebra/primitives/value.rb lib/arel/algebra/relations/operations/join.rb lib/arel/algebra/relations/relation.rb spec/arel/unit/relations/join_spec.rb
Diffstat (limited to 'lib/arel/engines')
-rw-r--r--lib/arel/engines/sql/primitives.rb18
-rw-r--r--lib/arel/engines/sql/relations/operations/join.rb14
2 files changed, 24 insertions, 8 deletions
diff --git a/lib/arel/engines/sql/primitives.rb b/lib/arel/engines/sql/primitives.rb
index c4968558a2..6f89723afe 100644
--- a/lib/arel/engines/sql/primitives.rb
+++ b/lib/arel/engines/sql/primitives.rb
@@ -3,7 +3,7 @@ module Arel
def column
original_relation.column_for(self)
end
-
+
def format(object)
object.to_sql(Sql::Attribute.new(self))
end
@@ -14,6 +14,8 @@ module Arel
end
class Value
+ delegate :inclusion_predicate_sql, :equality_predicate_sql, :to => :value
+
def to_sql(formatter = Sql::WhereCondition.new(relation))
formatter.value value
end
@@ -22,33 +24,33 @@ module Arel
object.to_sql(Sql::Value.new(relation))
end
end
-
+
class Expression < Attribute
def to_sql(formatter = Sql::SelectClause.new(relation))
formatter.expression self
end
end
-
+
class Count < Expression
def function_sql; 'COUNT' end
end
-
+
class Distinct < Expression
def function_sql; 'DISTINCT' end
end
-
+
class Sum < Expression
def function_sql; 'SUM' end
end
-
+
class Maximum < Expression
def function_sql; 'MAX' end
end
-
+
class Minimum < Expression
def function_sql; 'MIN' end
end
-
+
class Average < Expression
def function_sql; 'AVG' end
end
diff --git a/lib/arel/engines/sql/relations/operations/join.rb b/lib/arel/engines/sql/relations/operations/join.rb
index be21119bc9..2f5e23644e 100644
--- a/lib/arel/engines/sql/relations/operations/join.rb
+++ b/lib/arel/engines/sql/relations/operations/join.rb
@@ -16,4 +16,18 @@ module Arel
end
end
end
+
+ class InnerJoin < Join
+ def join_sql; "INNER JOIN" end
+ end
+
+ class OuterJoin < Join
+ def join_sql; "OUTER JOIN" end
+ end
+
+ class StringJoin < Join
+ def joins(_, __ = nil)
+ relation2
+ end
+ end
end \ No newline at end of file