From 20a10e5302ce8f912d27c57702b542a019c7f9f9 Mon Sep 17 00:00:00 2001 From: Raimonds Simanovskis Date: Wed, 10 Feb 2010 19:50:59 +0200 Subject: changes for Oracle support - OracleCompiler and corresponding tests with Oracle syntax --- .../sql/integration/joins/with_adjacency_spec.rb | 59 ++++++++++++++++++++-- 1 file changed, 54 insertions(+), 5 deletions(-) (limited to 'spec/arel/engines/sql/integration/joins/with_adjacency_spec.rb') diff --git a/spec/arel/engines/sql/integration/joins/with_adjacency_spec.rb b/spec/arel/engines/sql/integration/joins/with_adjacency_spec.rb index 37afb1a8f2..47d37415ae 100644 --- a/spec/arel/engines/sql/integration/joins/with_adjacency_spec.rb +++ b/spec/arel/engines/sql/integration/joins/with_adjacency_spec.rb @@ -22,7 +22,16 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME", "USERS_2"."ID", "USERS_2"."NAME" + FROM "USERS" + INNER JOIN "USERS" "USERS_2" + ON "USERS"."ID" = "USERS_2"."ID" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name", "users_2"."id", "users_2"."name" FROM "users" @@ -48,7 +57,16 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME", "USERS_2"."ID", "USERS_2"."NAME" + FROM "USERS" + INNER JOIN "USERS" "USERS_2" + ON "USERS"."ID" = "USERS_2"."ID" AND "USERS_2"."ID" = 1 + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name", "users_2"."id", "users_2"."name" FROM "users" @@ -76,7 +94,16 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME", "USERS_2"."ID", "USERS_2"."NAME" + FROM "USERS" + INNER JOIN "USERS" "USERS_2" + ON "USERS_2"."ID" = "USERS"."ID" AND "USERS_2"."ID" = 1 + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name", "users_2"."id", "users_2"."name" FROM "users" @@ -113,7 +140,18 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME", "USERS_2"."ID", "USERS_2"."NAME", "USERS_3"."ID", "USERS_3"."NAME" + FROM "USERS" + INNER JOIN "USERS" "USERS_2" + ON "USERS"."ID" = "USERS_2"."ID" + INNER JOIN "USERS" "USERS_3" + ON "USERS_2"."ID" = "USERS_3"."ID" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name", "users_2"."id", "users_2"."name", "users_3"."id", "users_3"."name" FROM "users" @@ -144,7 +182,18 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME", "USERS_2"."ID", "USERS_2"."NAME", "USERS_3"."ID", "USERS_3"."NAME" + FROM "USERS" + INNER JOIN "USERS" "USERS_2" + ON "USERS"."ID" = "USERS_2"."ID" + INNER JOIN "USERS" "USERS_3" + ON "USERS_2"."ID" = "USERS_3"."ID" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name", "users_2"."id", "users_2"."name", "users_3"."id", "users_3"."name" FROM "users" -- cgit v1.2.3