@steedos/odata-v4-sql 2.2.52-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +22 -0
- package/README.md +62 -0
- package/lib/index.d.ts +31 -0
- package/lib/index.js +22 -0
- package/lib/index.js.map +1 -0
- package/lib/visitor.d.ts +72 -0
- package/lib/visitor.js +393 -0
- package/lib/visitor.js.map +1 -0
- package/package.json +46 -0
- package/src/index.ts +45 -0
- package/src/visitor.ts +411 -0
- package/test/mssql.spec.js +142 -0
- package/test/oracle.spec.js +138 -0
- package/test/query.spec.js +93 -0
- package/test/where-parameters.spec.js +141 -0
- package/test/where.spec.js +149 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
var createFilter = require('../lib').createFilter
|
|
2
|
+
var expect = require('chai').expect
|
|
3
|
+
|
|
4
|
+
describe("SQL WHERE useParameters (ORACLE-SQL)", () => {
|
|
5
|
+
var f;
|
|
6
|
+
beforeEach(function() {
|
|
7
|
+
var match;
|
|
8
|
+
if (match = this.currentTest.title.match(/expression[^\:]*\: ?(.*)/)) {
|
|
9
|
+
f = createFilter(match[1], {
|
|
10
|
+
useParameters: true,
|
|
11
|
+
type: 4
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
//all numbers are referencing this:
|
|
17
|
+
//http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398116
|
|
18
|
+
|
|
19
|
+
it("expression 5.1.1.6.1: NullValue eq null", () => {
|
|
20
|
+
expect(f.where).to.equal("[NullValue] IS NULL");
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it("expression 5.1.1.6.1: TrueValue eq true", () => {
|
|
24
|
+
expect(f.where).to.equal("[TrueValue] = :p0");
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it("expression 5.1.1.6.1: FalseValue eq false", () => {
|
|
28
|
+
expect(f.where).to.equal("[FalseValue] = :p0");
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it("expression 5.1.1.6.1: IntegerValue lt -128", () => {
|
|
32
|
+
expect(f.where).to.equal("[IntegerValue] < :p0");
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it("expression 5.1.1.6.1: DecimalValue eq 34.95", () => {
|
|
36
|
+
expect(f.where).to.equal("[DecimalValue] = :p0");
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it("expression 5.1.1.6.1: StringValue eq 'Say Hello,then go'", () => {
|
|
40
|
+
expect(f.where).to.equal("[StringValue] = :p0");
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it("expression 5.1.1.6.1: DurationValue eq duration'P12DT23H59M59.999999999999S'", () => {
|
|
44
|
+
expect(f.where).to.equal("[DurationValue] = :p0");
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it("expression 5.1.1.6.1: DateValue eq 2012-12-03", () => {
|
|
48
|
+
expect(f.where).to.equal("[DateValue] = :p0");
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it("expression 5.1.1.6.1: DateTimeOffsetValue eq 2012-12-03T07:16:23Z", () => {
|
|
52
|
+
expect(f.where).to.equal("[DateTimeOffsetValue] = :p0");
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it("expression 5.1.1.6.1: GuidValue eq 01234567-89ab-cdef-0123-456789abcdef", () => {
|
|
56
|
+
expect(f.where).to.equal("[GuidValue] = :p0");
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it("expression 5.1.1.6.1: Int64Value eq 0", () => {
|
|
60
|
+
expect(f.where).to.equal("[Int64Value] = :p0");
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it("expression 5.1.1.6.1: A eq 0.31415926535897931e1", () => {
|
|
64
|
+
expect(f.where).to.equal("[A] = :p0");
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it("expression 5.1.1.1.2: A ne 1", () => {
|
|
68
|
+
expect(f.where).to.equal("[A] <> :p0");
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it("expression 5.1.1.1.3: A gt 2", () => {
|
|
72
|
+
expect(f.where).to.equal("[A] > :p0");
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it("expression 5.1.1.1.4: A ge 3", () => {
|
|
76
|
+
expect(f.where).to.equal("[A] >= :p0");
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
it("expression 5.1.1.1.5: A lt 2", () => {
|
|
80
|
+
expect(f.where).to.equal("[A] < :p0");
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
it("expression 5.1.1.1.6: A le 2", () => {
|
|
84
|
+
expect(f.where).to.equal("[A] <= :p0");
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
it("expression 5.1.1.3: (A eq 2) or (B lt 4) and ((E gt 5) or (E lt -1))", () => {
|
|
88
|
+
expect(f.where).to.equal("([A] = :p0) OR ([B] < :p1) AND (([E] > :p2) OR ([E] < :p3))");
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
it("expression 5.1.1.4.1: contains(A, 'BC')", () => {
|
|
92
|
+
expect(f.where).to.equal("[A] like :p0");
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it("expression 5.1.1.4.2: endswith(A, 'CD')", () => {
|
|
96
|
+
expect(f.where).to.equal("[A] like :p0");
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it("expression 5.1.1.4.3: startswith(A, 'CD')", () => {
|
|
100
|
+
expect(f.where).to.equal("[A] like :p0");
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
it("expression 5.1.1.4.4: length(A) eq 3", () => {
|
|
104
|
+
expect(f.where).to.equal("LEN([A]) = :p0");
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it("expression 5.1.1.4.7: tolower(A) eq 'abc'", () => {
|
|
108
|
+
expect(f.where).to.equal("LCASE([A]) = :p0");
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it("expression 5.1.1.4.8: toupper(A) eq 'ABC'", () => {
|
|
112
|
+
expect(f.where).to.equal("UCASE([A]) = :p0");
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
it("expression 5.1.1.4.9: trim(A) eq 'abc'", () => {
|
|
116
|
+
expect(f.where).to.equal("TRIM(' ' FROM [A]) = :p0");
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
it("expression 5.1.1.4.11: A eq year(2016-01-01T13:00Z)", () => {
|
|
120
|
+
expect(f.where).to.equal("[A] = YEAR(:p0)")
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
it("expression 5.1.1.4.21: year(now())", () => {
|
|
124
|
+
expect(f.where).to.equal("YEAR(NOW())")
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it("expression 5.1.1.4.25: round(A) eq 42", () => {
|
|
128
|
+
expect(f.where).to.equal("ROUND([A]) = :p0")
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
it("expression 5.1.1.4.26: floor(A) eq 42", () => {
|
|
132
|
+
expect(f.where).to.equal("FLOOR([A]) = :p0")
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
it("expression 5.1.1.4.27: ceiling(A) eq 42", () => {
|
|
136
|
+
expect(f.where).to.equal("CEILING([A]) = :p0")
|
|
137
|
+
})
|
|
138
|
+
})
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var createQuery = require('../lib').createQuery
|
|
2
|
+
var expect = require('chai').expect
|
|
3
|
+
|
|
4
|
+
describe("SQL SELECT", () => {
|
|
5
|
+
var f;
|
|
6
|
+
beforeEach(function() {
|
|
7
|
+
var match;
|
|
8
|
+
if (match = this.currentTest.title.match(/expression[^\:]*\: ?(.*)/)) {
|
|
9
|
+
f = createQuery(match[1]);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("expression: $select=Id", () => {
|
|
14
|
+
expect(f.select).to.equal("[Id]");
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("expression: $select=Id,Value", () => {
|
|
18
|
+
expect(f.select).to.equal("[Id], [Value]");
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe("SQL ORDER BY", () => {
|
|
23
|
+
var f;
|
|
24
|
+
beforeEach(function() {
|
|
25
|
+
var match;
|
|
26
|
+
if (match = this.currentTest.title.match(/expression[^\:]*\: ?(.*)/)) {
|
|
27
|
+
f = createQuery(match[1]);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("expression: $orderby=Id", () => {
|
|
32
|
+
expect(f.orderby).to.equal("[Id] ASC");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("expression: $orderby=Id asc", () => {
|
|
36
|
+
expect(f.orderby).to.equal("[Id] ASC");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("expression: $orderby=Id desc", () => {
|
|
40
|
+
expect(f.orderby).to.equal("[Id] DESC");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("expression: $orderby=Id,Value desc", () => {
|
|
44
|
+
expect(f.orderby).to.equal("[Id] ASC, [Value] DESC");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("expression: $orderby=Id asc,Value desc", () => {
|
|
48
|
+
expect(f.orderby).to.equal("[Id] ASC, [Value] DESC");
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe("OData $expand", () => {
|
|
53
|
+
var f;
|
|
54
|
+
beforeEach(function() {
|
|
55
|
+
var match;
|
|
56
|
+
if (match = this.currentTest.title.match(/expression[^\:]*\: ?(.*)/)) {
|
|
57
|
+
f = createQuery(match[1], {
|
|
58
|
+
useParameters: false
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("expression: $expand=Child", () => {
|
|
64
|
+
expect(f.includes).to.be.an.array;
|
|
65
|
+
expect(f.includes.length).to.equal(1);
|
|
66
|
+
expect(f.includes[0].navigationProperty).to.equal("Child");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("expression: $expand=Child($filter=Id eq 1)", () => {
|
|
70
|
+
expect(f.includes).to.be.an.array;
|
|
71
|
+
expect(f.includes.length).to.equal(1);
|
|
72
|
+
expect(f.includes[0].navigationProperty).to.equal("Child");
|
|
73
|
+
expect(f.includes[0].where).to.equal("[Id] = 1");
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
describe("SQL statement", () => {
|
|
78
|
+
var f;
|
|
79
|
+
beforeEach(function() {
|
|
80
|
+
var match;
|
|
81
|
+
if (match = this.currentTest.title.match(/expression[^\:]*\: ?(.*)/)) {
|
|
82
|
+
f = createQuery(match[1]);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("expression: $top=2", () => {
|
|
87
|
+
expect(f.from("dummy")).to.equal("SELECT * FROM [dummy] WHERE 1 = 1 ORDER BY 1 LIMIT 2");
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("expression: $skip=1&$top=2", () => {
|
|
91
|
+
expect(f.from("dummy")).to.equal("SELECT * FROM [dummy] WHERE 1 = 1 ORDER BY 1 LIMIT 2 OFFSET 1");
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
var createFilter = require('../lib').createFilter
|
|
2
|
+
var expect = require('chai').expect
|
|
3
|
+
|
|
4
|
+
describe("SQL WHERE useParameters", () => {
|
|
5
|
+
var f;
|
|
6
|
+
beforeEach(function() {
|
|
7
|
+
var match;
|
|
8
|
+
if (match = this.currentTest.title.match(/expression[^\:]*\: ?(.*)/)) {
|
|
9
|
+
f = createFilter(match[1], {
|
|
10
|
+
useParameters: true
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
//all numbers are referencing this:
|
|
16
|
+
//http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398116
|
|
17
|
+
|
|
18
|
+
it("expression 5.1.1.6.1: NullValue eq null", () => {
|
|
19
|
+
expect(f.where).to.equal("[NullValue] IS NULL")
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it("expression 5.1.1.6.1: TrueValue eq true", () => {
|
|
23
|
+
expect(f.where).to.equal("[TrueValue] = ?")
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it("expression 5.1.1.6.1: FalseValue eq false", () => {
|
|
27
|
+
expect(f.where).to.equal("[FalseValue] = ?")
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it("expression 5.1.1.6.1: IntegerValue lt -128", () => {
|
|
31
|
+
expect(f.where).to.equal("[IntegerValue] < ?")
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it("expression 5.1.1.6.1: DecimalValue eq 34.95", () => {
|
|
35
|
+
expect(f.where).to.equal("[DecimalValue] = ?")
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it("expression 5.1.1.6.1: StringValue eq 'Say Hello,then go'", () => {
|
|
39
|
+
expect(f.where).to.equal("[StringValue] = ?")
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it("expression 5.1.1.6.1: DurationValue eq duration'P12DT23H59M59.999999999999S'", () => {
|
|
43
|
+
expect(f.where).to.equal("[DurationValue] = ?")
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it("expression 5.1.1.6.1: DateValue eq 2012-12-03", () => {
|
|
47
|
+
expect(f.where).to.equal("[DateValue] = ?")
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it("expression 5.1.1.6.1: DateTimeOffsetValue eq 2012-12-03T07:16:23Z", () => {
|
|
51
|
+
expect(f.where).to.equal("[DateTimeOffsetValue] = ?")
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it("expression 5.1.1.6.1: GuidValue eq 01234567-89ab-cdef-0123-456789abcdef", () => {
|
|
55
|
+
expect(f.where).to.equal("[GuidValue] = ?")
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it("expression 5.1.1.6.1: Int64Value eq 0", () => {
|
|
59
|
+
expect(f.where).to.equal("[Int64Value] = ?")
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it("expression 5.1.1.6.1: A eq 0.31415926535897931e1", () => {
|
|
63
|
+
expect(f.where).to.equal("[A] = ?")
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it("expression 5.1.1.1.2: A ne 1", () => {
|
|
67
|
+
expect(f.where).to.equal("[A] <> ?")
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it("expression 5.1.1.1.3: A gt 2", () => {
|
|
71
|
+
expect(f.where).to.equal("[A] > ?")
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
it("expression 5.1.1.1.4: A ge 3", () => {
|
|
75
|
+
expect(f.where).to.equal("[A] >= ?")
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it("expression 5.1.1.1.5: A lt 2", () => {
|
|
79
|
+
expect(f.where).to.equal("[A] < ?")
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it("expression 5.1.1.1.6: A le 2", () => {
|
|
83
|
+
expect(f.where).to.equal("[A] <= ?")
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it("expression 5.1.1.3: (A eq 2) or (B lt 4) and ((E gt 5) or (E lt -1))", () => {
|
|
87
|
+
expect(f.where).to.equal("([A] = ?) OR ([B] < ?) AND (([E] > ?) OR ([E] < ?))")
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
it("expression 5.1.1.4.1: contains(A, 'BC')", () => {
|
|
91
|
+
expect(f.where).to.equal("[A] like ?");
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it("expression 5.1.1.4.2: endswith(A, 'CD')", () => {
|
|
95
|
+
expect(f.where).to.equal("[A] like ?");
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it("expression 5.1.1.4.3: startswith(A, 'CD')", () => {
|
|
99
|
+
expect(f.where).to.equal("[A] like ?");
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it("expression 5.1.1.4.4: length(A) eq 3", () => {
|
|
103
|
+
expect(f.where).to.equal("LEN([A]) = ?")
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it("expression 5.1.1.4.5: indexof(A, 'BC') eq 1", () => {
|
|
107
|
+
expect(f.where).to.equal("INSTR([A], ?) - 1 = ?")
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it("expression 5.1.1.4.7: tolower(A) eq 'abc'", () => {
|
|
111
|
+
expect(f.where).to.equal("LCASE([A]) = ?")
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it("expression 5.1.1.4.8: toupper(A) eq 'ABC'", () => {
|
|
115
|
+
expect(f.where).to.equal("UCASE([A]) = ?")
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it("expression 5.1.1.4.9: trim(A) eq 'abc'", () => {
|
|
119
|
+
expect(f.where).to.equal("TRIM(' ' FROM [A]) = ?")
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
it("expression 5.1.1.4.11: A eq year(2016-01-01T13:00Z)", () => {
|
|
123
|
+
expect(f.where).to.equal("[A] = YEAR(?)")
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
it("expression 5.1.1.4.21: year(now())", () => {
|
|
127
|
+
expect(f.where).to.equal("YEAR(NOW())")
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
it("expression 5.1.1.4.25: round(A) eq 42", () => {
|
|
131
|
+
expect(f.where).to.equal("ROUND([A]) = ?")
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
it("expression 5.1.1.4.26: floor(A) eq 42", () => {
|
|
135
|
+
expect(f.where).to.equal("FLOOR([A]) = ?")
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
it("expression 5.1.1.4.27: ceiling(A) eq 42", () => {
|
|
139
|
+
expect(f.where).to.equal("CEILING([A]) = ?")
|
|
140
|
+
})
|
|
141
|
+
})
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
var createFilter = require('../lib').createFilter
|
|
2
|
+
var expect = require('chai').expect
|
|
3
|
+
|
|
4
|
+
describe("SQL WHERE", () => {
|
|
5
|
+
var f;
|
|
6
|
+
beforeEach(function() {
|
|
7
|
+
var match;
|
|
8
|
+
if (match = this.currentTest.title.match(/expression[^\:]*\: ?(.*)/)) {
|
|
9
|
+
f = createFilter(match[1], {
|
|
10
|
+
useParameters: false
|
|
11
|
+
}).where;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
//all numbers are referencing this:
|
|
16
|
+
//http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398116
|
|
17
|
+
|
|
18
|
+
it("expression 5.1.1.6.1: 1 eq 1", () => {
|
|
19
|
+
expect(f).to.equal("1 = 1")
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it("expression 5.1.1.6.1: NullValue eq null", () => {
|
|
23
|
+
expect(f).to.equal("[NullValue] IS NULL")
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it("expression 5.1.1.6.1: null eq NullValue", () => {
|
|
27
|
+
expect(f).to.equal("[NullValue] IS NULL")
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it("expression 5.1.1.6.1: TrueValue eq true", () => {
|
|
31
|
+
expect(f).to.equal("[TrueValue] = 1")
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it("expression 5.1.1.6.1: FalseValue eq false", () => {
|
|
35
|
+
expect(f).to.equal("[FalseValue] = 0")
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it("expression 5.1.1.6.1: IntegerValue lt -128", () => {
|
|
39
|
+
expect(f).to.equal("[IntegerValue] < -128")
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it("expression 5.1.1.6.1: DecimalValue eq 34.95", () => {
|
|
43
|
+
expect(f).to.equal("[DecimalValue] = 34.95")
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it("expression 5.1.1.6.1: StringValue eq 'Say Hello,then go'", () => {
|
|
47
|
+
expect(f).to.equal("[StringValue] = 'Say Hello,then go'")
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
xit("expression 5.1.1.6.1: DurationValue eq duration'P12DT23H59M59.999999999999S'", () => {
|
|
51
|
+
expect(f).to.equal("[DurationValue] = 1033199000")
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it("expression 5.1.1.6.1: DateValue eq 2012-12-03", () => {
|
|
55
|
+
expect(f).to.equal("[DateValue] = '2012-12-03'")
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it("expression 5.1.1.6.1: DateTimeOffsetValue eq 2012-12-03T07:16:23Z", () => {
|
|
59
|
+
expect(f).to.equal("[DateTimeOffsetValue] = '2012-12-03 07:16:23'")
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it("expression 5.1.1.6.1: GuidValue eq 01234567-89ab-cdef-0123-456789abcdef", () => {
|
|
63
|
+
expect(f).to.equal("[GuidValue] = '01234567-89ab-cdef-0123-456789abcdef'")
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it("expression 5.1.1.6.1: Int64Value eq 0", () => {
|
|
67
|
+
expect(f).to.equal("[Int64Value] = 0")
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it("expression 5.1.1.6.1: A eq 0.31415926535897931e1", () => {
|
|
71
|
+
expect(f).to.equal("[A] = 3.141592653589793")
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
it("expression 5.1.1.1.2: A ne 1", () => {
|
|
75
|
+
expect(f).to.equal("[A] <> 1")
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it("expression 5.1.1.1.3: A gt 2", () => {
|
|
79
|
+
expect(f).to.equal("[A] > 2")
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it("expression 5.1.1.1.4: A ge 3", () => {
|
|
83
|
+
expect(f).to.equal("[A] >= 3")
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it("expression 5.1.1.1.5: A lt 2", () => {
|
|
87
|
+
expect(f).to.equal("[A] < 2")
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
it("expression 5.1.1.1.6: A le 2", () => {
|
|
91
|
+
expect(f).to.equal("[A] <= 2")
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it("expression 5.1.1.3: (A eq 2) or (B lt 4) and ((E gt 5) or (E lt -1))", () => {
|
|
95
|
+
expect(f).to.equal("([A] = 2) OR ([B] < 4) AND (([E] > 5) OR ([E] < -1))")
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it("expression 5.1.1.4.1: contains(A, 'BC')", () => {
|
|
99
|
+
expect(f).to.equal("[A] like '%BC%'");
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it("expression 5.1.1.4.2: endswith(A, 'CD')", () => {
|
|
103
|
+
expect(f).to.equal("[A] like '%CD'");
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it("expression 5.1.1.4.3: startswith(A, 'CD')", () => {
|
|
107
|
+
expect(f).to.equal("[A] like 'CD%'");
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it("expression 5.1.1.4.4: length(A) eq 3", () => {
|
|
111
|
+
expect(f).to.equal("LEN([A]) = 3")
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it("expression 5.1.1.4.5: indexof(A, 'BC') eq 1", () => {
|
|
115
|
+
expect(f).to.equal("INSTR([A], 'BC') - 1 = 1")
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it("expression 5.1.1.4.7: tolower(A) eq 'abc'", () => {
|
|
119
|
+
expect(f).to.equal("LCASE([A]) = 'abc'")
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
it("expression 5.1.1.4.8: toupper(A) eq 'ABC'", () => {
|
|
123
|
+
expect(f).to.equal("UCASE([A]) = 'ABC'")
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
it("expression 5.1.1.4.9: trim(A) eq 'abc'", () => {
|
|
127
|
+
expect(f).to.equal("TRIM(' ' FROM [A]) = 'abc'")
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
it("expression 5.1.1.4.11: A eq year(2016-01-01T13:00Z)", () => {
|
|
131
|
+
expect(f).to.equal("[A] = YEAR('2016-01-01 13:00')")
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
it("expression 5.1.1.4.21: year(now())", () => {
|
|
135
|
+
expect(f).to.equal("YEAR(NOW())")
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
it("expression 5.1.1.4.25: round(A) eq 42", () => {
|
|
139
|
+
expect(f).to.equal("ROUND([A]) = 42")
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
it("expression 5.1.1.4.26: floor(A) eq 42", () => {
|
|
143
|
+
expect(f).to.equal("FLOOR([A]) = 42")
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
it("expression 5.1.1.4.27: ceiling(A) eq 42", () => {
|
|
147
|
+
expect(f).to.equal("CEILING([A]) = 42")
|
|
148
|
+
})
|
|
149
|
+
})
|