diff options
author | Raimonds Simanovskis <raimonds.simanovskis@gmail.com> | 2010-02-10 19:50:59 +0200 |
---|---|---|
committer | Raimonds Simanovskis <raimonds.simanovskis@gmail.com> | 2010-03-01 12:02:10 +0200 |
commit | 20a10e5302ce8f912d27c57702b542a019c7f9f9 (patch) | |
tree | 38de3309520244ba6fda99b8d47525852e926491 /spec/arel/engines/sql/unit/relations | |
parent | 98a87e181aed8131797e55db2ca957bc515cdaca (diff) | |
download | rails-20a10e5302ce8f912d27c57702b542a019c7f9f9.tar.gz rails-20a10e5302ce8f912d27c57702b542a019c7f9f9.tar.bz2 rails-20a10e5302ce8f912d27c57702b542a019c7f9f9.zip |
changes for Oracle support - OracleCompiler and corresponding tests with Oracle syntax
Diffstat (limited to 'spec/arel/engines/sql/unit/relations')
-rw-r--r-- | spec/arel/engines/sql/unit/relations/alias_spec.rb | 12 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/delete_spec.rb | 26 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/from_spec.rb | 18 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/group_spec.rb | 20 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/having_spec.rb | 11 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/insert_spec.rb | 25 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/join_spec.rb | 52 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/lock_spec.rb | 25 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/order_spec.rb | 56 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/project_spec.rb | 43 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/skip_spec.rb | 11 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/table_spec.rb | 27 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/take_spec.rb | 19 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/update_spec.rb | 48 | ||||
-rw-r--r-- | spec/arel/engines/sql/unit/relations/where_spec.rb | 20 |
15 files changed, 382 insertions, 31 deletions
diff --git a/spec/arel/engines/sql/unit/relations/alias_spec.rb b/spec/arel/engines/sql/unit/relations/alias_spec.rb index 55d5a9b671..a6fd7ab036 100644 --- a/spec/arel/engines/sql/unit/relations/alias_spec.rb +++ b/spec/arel/engines/sql/unit/relations/alias_spec.rb @@ -27,7 +27,17 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID" + FROM "USERS" + WHERE "USERS"."ID" = 1 + GROUP BY "USERS"."ID" + ORDER BY "USERS"."ID" ASC + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id" FROM "users" diff --git a/spec/arel/engines/sql/unit/relations/delete_spec.rb b/spec/arel/engines/sql/unit/relations/delete_spec.rb index 0b1e2329b6..302a13c688 100644 --- a/spec/arel/engines/sql/unit/relations/delete_spec.rb +++ b/spec/arel/engines/sql/unit/relations/delete_spec.rb @@ -14,7 +14,11 @@ module Arel sql.should be_like(%Q{DELETE FROM `users`}) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{DELETE FROM "USERS"}) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{DELETE FROM "users"}) end end @@ -30,7 +34,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + DELETE + FROM "USERS" + WHERE "USERS"."ID" = 1 + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ DELETE FROM "users" @@ -50,7 +62,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + DELETE + FROM "USERS" + WHERE ROWNUM <= 1 + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ DELETE FROM "users" diff --git a/spec/arel/engines/sql/unit/relations/from_spec.rb b/spec/arel/engines/sql/unit/relations/from_spec.rb index a611cd65f4..0be3ac0f9a 100644 --- a/spec/arel/engines/sql/unit/relations/from_spec.rb +++ b/spec/arel/engines/sql/unit/relations/from_spec.rb @@ -17,7 +17,14 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM workers + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM workers @@ -37,7 +44,14 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM users + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM users diff --git a/spec/arel/engines/sql/unit/relations/group_spec.rb b/spec/arel/engines/sql/unit/relations/group_spec.rb index 703dc35be5..72a9f4e99e 100644 --- a/spec/arel/engines/sql/unit/relations/group_spec.rb +++ b/spec/arel/engines/sql/unit/relations/group_spec.rb @@ -20,7 +20,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + GROUP BY "USERS"."ID" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" @@ -42,7 +50,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + GROUP BY asdf + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" diff --git a/spec/arel/engines/sql/unit/relations/having_spec.rb b/spec/arel/engines/sql/unit/relations/having_spec.rb index 915ee3af08..fe6f3cc520 100644 --- a/spec/arel/engines/sql/unit/relations/having_spec.rb +++ b/spec/arel/engines/sql/unit/relations/having_spec.rb @@ -20,7 +20,16 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "DEVELOPERS"."ID", "DEVELOPERS"."NAME", "DEVELOPERS"."SALARY", "DEVELOPERS"."DEPARTMENT", "DEVELOPERS"."CREATED_AT" + FROM "DEVELOPERS" + GROUP BY "DEVELOPERS"."DEPARTMENT" + HAVING MIN(salary) > 1000 + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "developers"."id", "developers"."name", "developers"."salary", "developers"."department", "developers"."created_at" FROM "developers" diff --git a/spec/arel/engines/sql/unit/relations/insert_spec.rb b/spec/arel/engines/sql/unit/relations/insert_spec.rb index 69c5bb052c..4b412093e4 100644 --- a/spec/arel/engines/sql/unit/relations/insert_spec.rb +++ b/spec/arel/engines/sql/unit/relations/insert_spec.rb @@ -46,6 +46,14 @@ module Arel RETURNING "id" }) end + + adapter_is :oracle do + @insertion.to_sql.should be_like(%Q{ + INSERT + INTO "USERS" + ("ID", "NAME") VALUES (1, 'nick') + }) + end end describe 'when given values whose types correspond to the types of the attributes' do @@ -78,6 +86,14 @@ module Arel RETURNING "id" }) end + + adapter_is :oracle do + @insertion.to_sql.should be_like(%Q{ + INSERT + INTO "USERS" + ("NAME") VALUES ('nick') + }) + end end end @@ -111,6 +127,15 @@ module Arel RETURNING "id" }) end + + adapter_is :oracle do + @insertion.to_sql.should be_like(%Q{ + INSERT + INTO "USERS" + ("ID") VALUES (1) + }) + end + end end end diff --git a/spec/arel/engines/sql/unit/relations/join_spec.rb b/spec/arel/engines/sql/unit/relations/join_spec.rb index b926c2aaab..2d23a06397 100644 --- a/spec/arel/engines/sql/unit/relations/join_spec.rb +++ b/spec/arel/engines/sql/unit/relations/join_spec.rb @@ -28,7 +28,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME", "PHOTOS"."ID", "PHOTOS"."USER_ID", "PHOTOS"."CAMERA_ID" + FROM "USERS" + INNER JOIN "PHOTOS" ON "USERS"."ID" = "PHOTOS"."USER_ID" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name", "photos"."id", "photos"."user_id", "photos"."camera_id" FROM "users" @@ -49,7 +57,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "SUPER_USERS"."ID", "SUPER_USERS"."NAME", "PHOTOS"."ID", "PHOTOS"."USER_ID", "PHOTOS"."CAMERA_ID" + FROM "USERS" "SUPER_USERS" + INNER JOIN "PHOTOS" ON "SUPER_USERS"."ID" = "PHOTOS"."USER_ID" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "super_users"."id", "super_users"."name", "photos"."id", "photos"."user_id", "photos"."camera_id" FROM "users" AS "super_users" @@ -71,7 +87,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "SUPER_USERS"."ID", "SUPER_USERS"."NAME", "SUPER_PHOTOS"."ID", "SUPER_PHOTOS"."USER_ID", "SUPER_PHOTOS"."CAMERA_ID" + FROM "USERS" "SUPER_USERS" + INNER JOIN "PHOTOS" "SUPER_PHOTOS" ON "SUPER_USERS"."ID" = "SUPER_PHOTOS"."USER_ID" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "super_users"."id", "super_users"."name", "super_photos"."id", "super_photos"."user_id", "super_photos"."camera_id" FROM "users" AS "super_users" @@ -95,7 +119,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + INNER JOIN asdf ON fdsa + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" @@ -119,7 +151,17 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + INNER JOIN asdf ON fdsa + INNER JOIN lifo ON fifo + INNER JOIN hatful ON hallow + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" diff --git a/spec/arel/engines/sql/unit/relations/lock_spec.rb b/spec/arel/engines/sql/unit/relations/lock_spec.rb index 23f8a9f577..72a8a2e457 100644 --- a/spec/arel/engines/sql/unit/relations/lock_spec.rb +++ b/spec/arel/engines/sql/unit/relations/lock_spec.rb @@ -30,6 +30,24 @@ module Arel FROM "users" }) end + + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" FOR UPDATE + }) + + sql_with_order_by = @relation.order(@relation[:id]).take(1).lock.to_sql + sql_with_order_by.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + WHERE "ID" IN (select * from + (SELECT "ID" FROM "USERS" ORDER BY "USERS"."ID" ASC) + where rownum <= 1) + FOR UPDATE + }) + + end end it "manufactures a select query locking with a given lock" do @@ -55,6 +73,13 @@ module Arel FROM "users" }) end + + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" LOCK IN SHARE MODE + }) + end end end end diff --git a/spec/arel/engines/sql/unit/relations/order_spec.rb b/spec/arel/engines/sql/unit/relations/order_spec.rb index 575e617021..3c9d9ef598 100644 --- a/spec/arel/engines/sql/unit/relations/order_spec.rb +++ b/spec/arel/engines/sql/unit/relations/order_spec.rb @@ -20,7 +20,31 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + ORDER BY "USERS"."ID" ASC + }) + + distinct_attributes = ActiveRecord::Base.connection.distinct('"USERS"."NAME"', '"USERS"."ID"') + @relation.project(distinct_attributes).order(@relation[:id]).to_sql.should be_like(%Q{ + SELECT DISTINCT "USERS"."NAME", + FIRST_VALUE("USERS"."ID") OVER (PARTITION BY "USERS"."NAME" ORDER BY "USERS"."ID") AS alias_0__ + FROM "USERS" + ORDER BY alias_0__ + }) + + distinct_attributes = ActiveRecord::Base.connection.distinct('"USERS"."NAME"', '"USERS"."ID" DESC') + @relation.project(distinct_attributes).order('"USERS"."ID" DESC').to_sql.should be_like(%Q{ + SELECT DISTINCT "USERS"."NAME", + FIRST_VALUE("USERS"."ID") OVER (PARTITION BY "USERS"."NAME" ORDER BY "USERS"."ID" DESC) AS alias_0__ + FROM "USERS" + ORDER BY alias_0__ DESC + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" @@ -46,7 +70,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + ORDER BY "USERS"."ID" ASC, "USERS"."NAME" ASC + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" @@ -72,7 +104,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + ORDER BY asdf + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" @@ -99,7 +139,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + ORDER BY "USERS"."NAME" ASC, "USERS"."ID" ASC + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" diff --git a/spec/arel/engines/sql/unit/relations/project_spec.rb b/spec/arel/engines/sql/unit/relations/project_spec.rb index 70f2dff70a..e73c7775a1 100644 --- a/spec/arel/engines/sql/unit/relations/project_spec.rb +++ b/spec/arel/engines/sql/unit/relations/project_spec.rb @@ -19,7 +19,14 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID" + FROM "USERS" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id" FROM "users" @@ -42,7 +49,13 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT (SELECT "USERS"."NAME" FROM "USERS") AS "USERS" FROM "USERS" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT (SELECT "users"."name" FROM "users") AS "users" FROM "users" }) @@ -60,7 +73,13 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT asdf FROM "USERS" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT asdf FROM "users" }) @@ -79,7 +98,14 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT COUNT("USERS"."ID") AS count_id + FROM "USERS" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT COUNT("users"."id") AS count_id FROM "users" @@ -97,7 +123,14 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT COUNT(DISTINCT "USERS"."ID") AS count_id + FROM "USERS" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT COUNT(DISTINCT "users"."id") AS count_id FROM "users" diff --git a/spec/arel/engines/sql/unit/relations/skip_spec.rb b/spec/arel/engines/sql/unit/relations/skip_spec.rb index 2d606359ee..41b80d12d8 100644 --- a/spec/arel/engines/sql/unit/relations/skip_spec.rb +++ b/spec/arel/engines/sql/unit/relations/skip_spec.rb @@ -19,7 +19,16 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + select * from (select raw_sql_.*, rownum raw_rnum_ from + (SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS") raw_sql_) + where raw_rnum_ > 4 + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" diff --git a/spec/arel/engines/sql/unit/relations/table_spec.rb b/spec/arel/engines/sql/unit/relations/table_spec.rb index d8584ccaec..e497e1b6c2 100644 --- a/spec/arel/engines/sql/unit/relations/table_spec.rb +++ b/spec/arel/engines/sql/unit/relations/table_spec.rb @@ -17,7 +17,14 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" @@ -37,7 +44,14 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "SUPER_USERS"."ID", "SUPER_USERS"."NAME" + FROM "USERS" "SUPER_USERS" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "super_users"."id", "super_users"."name" FROM "users" AS "super_users" @@ -55,7 +69,14 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" diff --git a/spec/arel/engines/sql/unit/relations/take_spec.rb b/spec/arel/engines/sql/unit/relations/take_spec.rb index 2a8aea3d9d..9f2967a0bd 100644 --- a/spec/arel/engines/sql/unit/relations/take_spec.rb +++ b/spec/arel/engines/sql/unit/relations/take_spec.rb @@ -19,7 +19,24 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + WHERE ROWNUM <= 4 + }) + + sql_with_order_by = Take.new(@relation.order(@relation[:id]), @taken).to_sql + sql_with_order_by.should be_like(%Q{ + select * from + (SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + ORDER BY "USERS"."ID" ASC) + where rownum <= 4 + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" diff --git a/spec/arel/engines/sql/unit/relations/update_spec.rb b/spec/arel/engines/sql/unit/relations/update_spec.rb index fd444e27a8..cc2ad9913b 100644 --- a/spec/arel/engines/sql/unit/relations/update_spec.rb +++ b/spec/arel/engines/sql/unit/relations/update_spec.rb @@ -36,6 +36,13 @@ module Arel SET "id" = 1, "name" = E'nick' }) end + + adapter_is :oracle do + sql.should be_like(%Q{ + UPDATE "USERS" + SET "ID" = 1, "NAME" = 'nick' + }) + end end it "manufactures sql updating attributes when given a ranged relation" do @@ -64,6 +71,23 @@ module Arel WHERE "id" IN (SELECT "id" FROM "users" LIMIT 1) }) end + + adapter_is :oracle do + sql.should be_like(%Q{ + UPDATE "USERS" SET + "NAME" = 'nick' + WHERE "ID" IN (SELECT "ID" FROM "USERS" WHERE ROWNUM <= 1) + }) + + sql_with_order_by = Update.new(@relation.order(@relation[:id]).take(1), @relation[:name] => "nick").to_sql + sql_with_order_by.should be_like(%Q{ + UPDATE "USERS" SET + "NAME" = 'nick' + WHERE "ID" IN (select * from + (SELECT "ID" FROM "USERS" ORDER BY "USERS"."ID" ASC) + where rownum <= 1) + }) + end end describe 'when given values whose types correspond to the types of the attributes' do @@ -92,6 +116,13 @@ module Arel SET "name" = E'nick' }) end + + adapter_is :oracle do + @update.to_sql.should be_like(%Q{ + UPDATE "USERS" + SET "NAME" = 'nick' + }) + end end end @@ -108,7 +139,14 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + @update.to_sql.should be_like(%Q{ + UPDATE "USERS" + SET "ID" = 1 + }) + end + + adapter_is_not :mysql, :oracle do @update.to_sql.should be_like(%Q{ UPDATE "users" SET "id" = 1 @@ -149,6 +187,14 @@ module Arel WHERE "users"."id" = 1 }) end + + adapter_is :oracle do + @update.to_sql.should be_like(%Q{ + UPDATE "USERS" + SET "NAME" = 'nick' + WHERE "USERS"."ID" = 1 + }) + end end end end diff --git a/spec/arel/engines/sql/unit/relations/where_spec.rb b/spec/arel/engines/sql/unit/relations/where_spec.rb index 8f9a8db4c7..5f559efad3 100644 --- a/spec/arel/engines/sql/unit/relations/where_spec.rb +++ b/spec/arel/engines/sql/unit/relations/where_spec.rb @@ -20,7 +20,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + WHERE "USERS"."ID" = 1 + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" @@ -42,7 +50,15 @@ module Arel }) end - adapter_is_not :mysql do + adapter_is :oracle do + sql.should be_like(%Q{ + SELECT "USERS"."ID", "USERS"."NAME" + FROM "USERS" + WHERE asdf + }) + end + + adapter_is_not :mysql, :oracle do sql.should be_like(%Q{ SELECT "users"."id", "users"."name" FROM "users" |