-
Notifications
You must be signed in to change notification settings - Fork 527
Expand file tree
/
Copy pathLinqSQLTranslationBaselineTest.ValidateSQLTranslation.xml
More file actions
285 lines (285 loc) · 9.23 KB
/
LinqSQLTranslationBaselineTest.ValidateSQLTranslation.xml
File metadata and controls
285 lines (285 loc) · 9.23 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<Results>
<Result>
<Input>
<Description><![CDATA[Select cast float]]></Description>
<Expression><![CDATA[query.Select(x => Convert(DisplayClass.floatValue, Int32))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE 5
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select identity]]></Description>
<Expression><![CDATA[query.Select(x => x)]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select int expr]]></Description>
<Expression><![CDATA[query.Select(x => (((x.x % 10) + 2) + (x.x % 5)))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE (((root["x"] % 10) + 2) + (root["x"] % 5))
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select int expr w const]]></Description>
<Expression><![CDATA[query.Select(x => (x.x + DisplayClass.constInt))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE (root["x"] + 2)
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select w new array]]></Description>
<Expression><![CDATA[query.Select(d => new [] {d.x, (d.x + 1)})]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE [root["x"], (root["x"] + 1)]
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select new]]></Description>
<Expression><![CDATA[query.Select(d => new AnonymousType(first = d.x, second = d.x))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE {"first": root["x"], "second": root["x"]}
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select nested new]]></Description>
<Expression><![CDATA[query.Select(d => new AnonymousType(first = d.x, second = new AnonymousType(third = d.x)))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE {"first": root["x"], "second": {"third": root["x"]}}
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Filter int >]]></Description>
<Expression><![CDATA[query.Where(x => (x.x > 2))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root
FROM root
WHERE (root["x"] > 2)]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Filter method >]]></Description>
<Expression><![CDATA[query.Where(x => (x.x > id(3)))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root
FROM root
WHERE (root["x"] > 3)]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Filter int > -> Select int expr]]></Description>
<Expression><![CDATA[query.Where(x => (x.x > 2)).Select(x => (x.x + 2))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE (root["x"] + 2)
FROM root
WHERE (root["x"] > 2)]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select int expr -> Filter int >]]></Description>
<Expression><![CDATA[query.Select(x => (x.x + 2)).Where(x => (x > 2))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE (root["x"] + 2)
FROM root
WHERE ((root["x"] + 2) > 2)]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Filter int > -> Filter another field]]></Description>
<Expression><![CDATA[query.Where(x => (x.x > 2)).Where(y => (y.x < 4))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root
FROM root
WHERE ((root["x"] > 2) AND (root["x"] < 4))]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Filter x -> Filter y -> Select y expr]]></Description>
<Expression><![CDATA[query.Where(x => (x.x > 2)).Where(y => (y.x < 4)).Select(y => (y.x + y.x))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE (root["x"] + root["x"])
FROM root
WHERE ((root["x"] > 2) AND (root["x"] < 4))]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select expr w const array]]></Description>
<Expression><![CDATA[query.Select(x => (x.x + DisplayClass.array[2]))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE (root["x"] + 3)
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select const array index]]></Description>
<Expression><![CDATA[query.Where(x => ((x.x >= 0) AndAlso (x.x < 3))).Select(x => new [] {1, 2, 3}[x.x])]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE [1, 2, 3][root["x"]]
FROM root
WHERE ((root["x"] >= 0) AND (root["x"] < 3))]]></SqlQuery>
<ErrorMessage><![CDATA[Status Code: BadRequest,{"errors":[{"severity":"Error","location":{"start":13,"end":33},"code":"SC2990","message":"The specified query includes 'member indexer' which is currently not supported."}]},0x800A0B00]]></ErrorMessage>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select new simple]]></Description>
<Expression><![CDATA[query.Select(x => new simple() {x = x.x, y = x.x})]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE {"x": root["x"], "y": root["x"]}
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select new nested]]></Description>
<Expression><![CDATA[query.Select(x => new nested() {s = new simple() {x = x.x, y = x.x}, x = 2})]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE {"s": {"x": root["x"], "y": root["x"]}, "x": 2}
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select new complex]]></Description>
<Expression><![CDATA[query.Select(d => new complex() {dbl = 1, str = "", b = False, dblArray = new [] {1, 2}, inside = new simple() {x = d.x, y = d.x}})]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE {"dbl": 1, "str": "", "b": false, "dblArray": [1, 2], "inside": {"x": root["x"], "y": root["x"]}}
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select cast double x]]></Description>
<Expression><![CDATA[query.Select(x => Convert(x.x, Double))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root["x"]
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select indexer x]]></Description>
<Expression><![CDATA[query.Where(x => ((x.x >= 0) AndAlso (x.x < ArrayLength(DisplayClass.array)))).Select(x => DisplayClass.array[x.x])]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE [1, 2, 3][root["x"]]
FROM root
WHERE ((root["x"] >= 0) AND (root["x"] < 3))]]></SqlQuery>
<ErrorMessage><![CDATA[Status Code: BadRequest,{"errors":[{"severity":"Error","location":{"start":13,"end":33},"code":"SC2990","message":"The specified query includes 'member indexer' which is currently not supported."}]},0x800A0B00]]></ErrorMessage>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select new constructor]]></Description>
<Expression><![CDATA[query.Select(x => new TimeSpan(Convert(x.x, Int64)))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[]]></SqlQuery>
<ErrorMessage><![CDATA[Constructor invocation is not supported.]]></ErrorMessage>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select method id]]></Description>
<Expression><![CDATA[query.Select(x => id(x))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[]]></SqlQuery>
<ErrorMessage><![CDATA[Method 'id' is not supported.]]></ErrorMessage>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select identity]]></Description>
<Expression><![CDATA[query.Select(x => x)]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select simple property]]></Description>
<Expression><![CDATA[query.Select(x => x.x)]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root["x"]
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select extension data]]></Description>
<Expression><![CDATA[query.Select(x => new complex() {NewtonsoftExtensionData = new Dictionary`2() {Void Add(System.String, System.Object)("test", Convert(1.5, Object))}, NetExtensionData = new Dictionary`2() {Void Add(System.String, System.Object)("OtherTest", Convert(1.5, Object))}})]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE {"dbl": 0, "str": null, "b": false, "dblArray": null, "inside": {"x": 0, "y": 0, "id": null, "pk": null}, "id": null, "pk": null, "NetExtensionData": {"OtherTest": 1.5}, "test": 1.5}
FROM root]]></SqlQuery>
</Output>
</Result>
</Results>