forked from brianc/node-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunary-clause-tests.js
More file actions
55 lines (52 loc) · 2.78 KB
/
unary-clause-tests.js
File metadata and controls
55 lines (52 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict';
var Harness = require('./support');
var customer = Harness.defineCustomerTable();
var post = Harness.definePostTable();
Harness.test({
query: customer.select().where(customer.age.isNotNull()),
pg: {
text : 'SELECT "customer".* FROM "customer" WHERE ("customer"."age" IS NOT NULL)',
string: 'SELECT "customer".* FROM "customer" WHERE ("customer"."age" IS NOT NULL)'
},
sqlite: {
text : 'SELECT "customer".* FROM "customer" WHERE ("customer"."age" IS NOT NULL)',
string: 'SELECT "customer".* FROM "customer" WHERE ("customer"."age" IS NOT NULL)'
},
mysql: {
text : 'SELECT `customer`.* FROM `customer` WHERE (`customer`.`age` IS NOT NULL)',
string: 'SELECT `customer`.* FROM `customer` WHERE (`customer`.`age` IS NOT NULL)'
},
mssql: {
text : 'SELECT [customer].* FROM [customer] WHERE ([customer].[age] IS NOT NULL)',
string: 'SELECT [customer].* FROM [customer] WHERE ([customer].[age] IS NOT NULL)'
},
oracle: {
text : 'SELECT "customer".* FROM "customer" WHERE ("customer"."age" IS NOT NULL)',
string: 'SELECT "customer".* FROM "customer" WHERE ("customer"."age" IS NOT NULL)'
},
params: []
});
Harness.test({
query: post.select().where(post.userId. in (customer.subQuery().select(customer.id).where(customer.age.isNull()))),
pg: {
text : 'SELECT "post".* FROM "post" WHERE ("post"."userId" IN (SELECT "customer"."id" FROM "customer" WHERE ("customer"."age" IS NULL)))',
string: 'SELECT "post".* FROM "post" WHERE ("post"."userId" IN (SELECT "customer"."id" FROM "customer" WHERE ("customer"."age" IS NULL)))'
},
sqlite: {
text : 'SELECT "post".* FROM "post" WHERE ("post"."userId" IN (SELECT "customer"."id" FROM "customer" WHERE ("customer"."age" IS NULL)))',
string: 'SELECT "post".* FROM "post" WHERE ("post"."userId" IN (SELECT "customer"."id" FROM "customer" WHERE ("customer"."age" IS NULL)))'
},
mysql: {
text : 'SELECT `post`.* FROM `post` WHERE (`post`.`userId` IN (SELECT `customer`.`id` FROM `customer` WHERE (`customer`.`age` IS NULL)))',
string: 'SELECT `post`.* FROM `post` WHERE (`post`.`userId` IN (SELECT `customer`.`id` FROM `customer` WHERE (`customer`.`age` IS NULL)))'
},
mssql: {
text : 'SELECT [post].* FROM [post] WHERE ([post].[userId] IN (SELECT [customer].[id] FROM [customer] WHERE ([customer].[age] IS NULL)))',
string: 'SELECT [post].* FROM [post] WHERE ([post].[userId] IN (SELECT [customer].[id] FROM [customer] WHERE ([customer].[age] IS NULL)))'
},
oracle: {
text : 'SELECT "post".* FROM "post" WHERE ("post"."userId" IN (SELECT "customer"."id" FROM "customer" WHERE ("customer"."age" IS NULL)))',
string: 'SELECT "post".* FROM "post" WHERE ("post"."userId" IN (SELECT "customer"."id" FROM "customer" WHERE ("customer"."age" IS NULL)))'
},
params: []
});