forked from brianc/node-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalias-tests.js
More file actions
55 lines (51 loc) · 2.5 KB
/
Copy pathalias-tests.js
File metadata and controls
55 lines (51 loc) · 2.5 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();
Harness.test({
query: customer.select(customer.name.isNull().as('nameIsNull')),
pg: {
text : 'SELECT ("customer"."name" IS NULL) AS "nameIsNull" FROM "customer"',
string: 'SELECT ("customer"."name" IS NULL) AS "nameIsNull" FROM "customer"'
},
sqlite: {
text : 'SELECT ("customer"."name" IS NULL) AS "nameIsNull" FROM "customer"',
string: 'SELECT ("customer"."name" IS NULL) AS "nameIsNull" FROM "customer"'
},
mysql: {
text : 'SELECT (`customer`.`name` IS NULL) AS `nameIsNull` FROM `customer`',
string: 'SELECT (`customer`.`name` IS NULL) AS `nameIsNull` FROM `customer`'
},
params: []
});
Harness.test({
query: customer.select(customer.name.plus(customer.age).as('nameAndAge')).where(customer.age.gt(10).and(customer.age.lt(20))),
pg: {
text : 'SELECT ("customer"."name" + "customer"."age") AS "nameAndAge" FROM "customer" WHERE (("customer"."age" > $1) AND ("customer"."age" < $2))',
string: 'SELECT ("customer"."name" + "customer"."age") AS "nameAndAge" FROM "customer" WHERE (("customer"."age" > 10) AND ("customer"."age" < 20))'
},
sqlite: {
text : 'SELECT ("customer"."name" + "customer"."age") AS "nameAndAge" FROM "customer" WHERE (("customer"."age" > $1) AND ("customer"."age" < $2))',
string: 'SELECT ("customer"."name" + "customer"."age") AS "nameAndAge" FROM "customer" WHERE (("customer"."age" > 10) AND ("customer"."age" < 20))'
},
mysql: {
text : 'SELECT (`customer`.`name` + `customer`.`age`) AS `nameAndAge` FROM `customer` WHERE ((`customer`.`age` > ?) AND (`customer`.`age` < ?))',
string: 'SELECT (`customer`.`name` + `customer`.`age`) AS `nameAndAge` FROM `customer` WHERE ((`customer`.`age` > 10) AND (`customer`.`age` < 20))'
},
params: [10, 20]
});
Harness.test({
query: customer.select(customer.age.between(10, 20).as('ageBetween')),
pg: {
text : 'SELECT ("customer"."age" BETWEEN $1 AND $2) AS "ageBetween" FROM "customer"',
string: 'SELECT ("customer"."age" BETWEEN 10 AND 20) AS "ageBetween" FROM "customer"'
},
sqlite: {
text : 'SELECT ("customer"."age" BETWEEN $1 AND $2) AS "ageBetween" FROM "customer"',
string: 'SELECT ("customer"."age" BETWEEN 10 AND 20) AS "ageBetween" FROM "customer"'
},
mysql: {
text : 'SELECT (`customer`.`age` BETWEEN ? AND ?) AS `ageBetween` FROM `customer`',
string: 'SELECT (`customer`.`age` BETWEEN 10 AND 20) AS `ageBetween` FROM `customer`'
},
params: [10, 20]
});