From d85a13a6f6e67d10e3761740bae01a13926e75cc Mon Sep 17 00:00:00 2001 From: Vincent Schoettke Date: Mon, 11 Aug 2014 14:11:09 +0200 Subject: [PATCH] Reverted mysql overlapping join test --- test/integration/builder/joins.js | 115 +++++++++++++++--------------- 1 file changed, 58 insertions(+), 57 deletions(-) diff --git a/test/integration/builder/joins.js b/test/integration/builder/joins.js index 903be448..efa8131e 100644 --- a/test/integration/builder/joins.js +++ b/test/integration/builder/joins.js @@ -769,65 +769,66 @@ module.exports = function(knex) { it('supports joins with overlapping column names', function() { if (knex.client.dialect === 'oracle') { console.warn("Overlapping column names not supported with oracle"); - } else { - return knex('accounts as a1') - .leftJoin('accounts as a2', function() { - this.on('a1.email', '<>', 'a2.email'); - }) - .select(['a1.email', 'a2.email']) - .where('a1.id', '=', '1') - .options({ - nestTables: true, - rowMode: 'array' - }) - .limit(2) - .testSql(function(tester) { - tester( - 'mysql', - 'select `a1`.`email`, `a2`.`email` from `accounts` as `a1` left join `accounts` as `a2` on `a1`.`email` <> `a2`.`email` where a1.id = 1 limit ?', - [2], - [{ - a1: { - email: 'test@example.com' - }, - a2: { - email: 'test2@example.com' - } - },{ - a1: { - email: 'test@example.com' - }, - a2: { - email: 'test3@example.com' - } - }] - ); - tester( - 'postgres', - 'select "a1"."email", "a2"."email" from "accounts" as "a1" left join "accounts" as "a2" on "a1"."email" <> "a2"."email" where a1.id = 1 limit ?', - [2], - [{ - 0: 'test@example.com', - 1: 'test2@example.com' - },{ - 0: 'test@example.com', - 1: 'test3@example.com' - }] - ); - tester( - 'sqlite3', - 'select "a1"."email", "a2"."email" from "accounts" as "a1" left join "accounts" as "a2" on "a1"."email" <> "a2"."email" where a1.id = 1 limit ?', - [2], - [{ - email: 'test2@example.com' - },{ - email: 'test3@example.com' - }] - ); - }); + return; } + + return knex('accounts as a1') + .leftJoin('accounts as a2', function() { + this.on('a1.email', '<>', 'a2.email'); + }) + .select(['a1.email', 'a2.email']) + .where(knex.raw('a1.id = 1')) + .options({ + nestTables: true, + rowMode: 'array' + }) + .limit(2) + .testSql(function(tester) { + tester( + 'mysql', + 'select `a1`.`email`, `a2`.`email` from `accounts` as `a1` left join `accounts` as `a2` on `a1`.`email` <> `a2`.`email` where a1.id = 1 limit ?', + [2], + [{ + a1: { + email: 'test@example.com' + }, + a2: { + email: 'test2@example.com' + } + },{ + a1: { + email: 'test@example.com' + }, + a2: { + email: 'test3@example.com' + } + }] + ); + tester( + 'postgres', + 'select "a1"."email", "a2"."email" from "accounts" as "a1" left join "accounts" as "a2" on "a1"."email" <> "a2"."email" where a1.id = 1 limit ?', + [2], + [{ + 0: 'test@example.com', + 1: 'test2@example.com' + },{ + 0: 'test@example.com', + 1: 'test3@example.com' + }] + ); + tester( + 'sqlite3', + 'select "a1"."email", "a2"."email" from "accounts" as "a1" left join "accounts" as "a2" on "a1"."email" <> "a2"."email" where a1.id = 1 limit ?', + [2], + [{ + email: 'test2@example.com' + },{ + email: 'test3@example.com' + }] + ); + }); }); }); -}; \ No newline at end of file +};