-
Notifications
You must be signed in to change notification settings - Fork 527
Expand file tree
/
Copy pathLinqSQLTranslationBaselineTest.ValidateSQLTranslationComplexData.xml
More file actions
203 lines (203 loc) · 6.23 KB
/
LinqSQLTranslationBaselineTest.ValidateSQLTranslationComplexData.xml
File metadata and controls
203 lines (203 loc) · 6.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
<Results>
<Result>
<Input>
<Description><![CDATA[Select equality]]></Description>
<Expression><![CDATA[query.Select(s => (s.str == "5"))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE (root["str"] = "5")
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select string concat]]></Description>
<Expression><![CDATA[query.Select(d => ("x" + d.str))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE ("x" || root["str"])
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select string concat w const]]></Description>
<Expression><![CDATA[query.Select(d => (("x" + DisplayClass.constString) + d.str))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE ("xs" || root["str"])
FROM root]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[SelectMany array]]></Description>
<Expression><![CDATA[query.SelectMany(d => d.dblArray)]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE d0
FROM root
JOIN d0 IN root["dblArray"]]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[SelectMany array property -> Filter x -> Select x expr]]></Description>
<Expression><![CDATA[query.SelectMany(z => z.dblArray).Where(x => (x > 2)).Select(x => (x + 2))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE (z0 + 2)
FROM root
JOIN z0 IN root["dblArray"]
WHERE (z0 > 2)]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[SelectMany array property -> Filter x equality -> Select x expr]]></Description>
<Expression><![CDATA[query.SelectMany(z => z.dblArray.Where(x => (x == 3)).Select(x => (x + 1)))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE (x0 + 1)
FROM root
JOIN x0 IN root["dblArray"]
WHERE (x0 = 3)]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[SelectMany array property -> Select identity]]></Description>
<Expression><![CDATA[query.SelectMany(d => d.dblArray.Select(x => x))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE x0
FROM root
JOIN x0 IN root["dblArray"]]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[SelectMany array property]]></Description>
<Expression><![CDATA[query.SelectMany(d => d.dblArray)]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE d0
FROM root
JOIN d0 IN root["dblArray"]]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[SelectMany array property -> Select x expr]]></Description>
<Expression><![CDATA[query.SelectMany(z => z.dblArray.Select(x => (z.dbl + x)))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE (root["dbl"] + x0)
FROM root
JOIN x0 IN root["dblArray"]]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[SelectMany array property -> Select new]]></Description>
<Expression><![CDATA[query.SelectMany(z => z.dblArray.Select(x => new AnonymousType(b = z.b, x = Truncate((x * 100)))))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE {"b": root["b"], "x": TRUNC((x0 * 100))}
FROM root
JOIN x0 IN root["dblArray"]]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[SelectMany identity]]></Description>
<Expression><![CDATA[query.SelectMany(x => x.dblArray)]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE x0
FROM root
JOIN x0 IN root["dblArray"]]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[SelectMany x -> Select y]]></Description>
<Expression><![CDATA[query.SelectMany(x => x.dblArray.Select(y => y))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE y0
FROM root
JOIN y0 IN root["dblArray"]]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[SelectMany x -> Select x.y]]></Description>
<Expression><![CDATA[query.SelectMany(x => x.dblArray.Select(y => y))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE y0
FROM root
JOIN y0 IN root["dblArray"]]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[SelectMany array]]></Description>
<Expression><![CDATA[query.SelectMany(x => x.dblArray)]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE x0
FROM root
JOIN x0 IN root["dblArray"]]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select where extensiondata]]></Description>
<Expression><![CDATA[query.Where(p => (Convert(p.NewtonsoftExtensionData.get_Item("age"), Int32) > 18)).Select(x => new AnonymousType(Age = Convert(x.NewtonsoftExtensionData.get_Item("age"), Int32)))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE {"Age": root["age"]}
FROM root
WHERE (root["age"] > 18)]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[Select where extensiondata contains]]></Description>
<Expression><![CDATA[query.Where(p => Convert(p.NewtonsoftExtensionData.get_Item("tags"), String[]).Contains("item-1")).Select(x => Convert(x.NewtonsoftExtensionData.get_Item("tags"), String[]))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root["tags"]
FROM root
WHERE ARRAY_CONTAINS(root["tags"], "item-1")]]></SqlQuery>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[SelectMany where extensiondata contains]]></Description>
<Expression><![CDATA[query.Where(p => Convert(p.NewtonsoftExtensionData.get_Item("tags"), String[]).Contains("item-1")).SelectMany(x => Convert(x.NewtonsoftExtensionData.get_Item("tags"), Object[]))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[]]></SqlQuery>
<ErrorMessage><![CDATA[Expression with NodeType 'Convert' is not supported.]]></ErrorMessage>
</Output>
</Result>
</Results>