100{
101
102
103
104
105#line 12 "sqljson.pgc"
106 char json [ 1024 ] ;
107
108#line 13 "sqljson.pgc"
109 bool is_json [ 8 ] ;
110
111#line 14 "sqljson.pgc"
112
113
115
116 {
ECPGconnect(__LINE__, 0,
"ecpg1_regression" , NULL, NULL , NULL, 0);
117#line 18 "sqljson.pgc"
118
120#line 18 "sqljson.pgc"
121
123#line 19 "sqljson.pgc"
124
126#line 19 "sqljson.pgc"
127
128
130 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
132#line 21 "sqljson.pgc"
133
135#line 21 "sqljson.pgc"
136
137 printf(
"Found json=%s\n", json);
138
140 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
142#line 24 "sqljson.pgc"
143
145#line 24 "sqljson.pgc"
146
147 printf(
"Found json=%s\n", json);
148
150 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
152#line 27 "sqljson.pgc"
153
155#line 27 "sqljson.pgc"
156
157 printf(
"Found json=%s\n", json);
158
160 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
162#line 30 "sqljson.pgc"
163
165#line 30 "sqljson.pgc"
166
167 printf(
"Found json=%s\n", json);
168
170 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
172#line 33 "sqljson.pgc"
173
175#line 33 "sqljson.pgc"
176
177
178
179 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"select json_object ( 1 : 1 , '2' : null , 1 : '2' absent on null without unique keys )",
ECPGt_EOIT,
180 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
182#line 36 "sqljson.pgc"
183
185#line 36 "sqljson.pgc"
186
187 printf(
"Found json=%s\n", json);
188
189 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"select json_object ( 1 : 1 , '2' : null absent on null without unique returning jsonb )",
ECPGt_EOIT,
190 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
192#line 39 "sqljson.pgc"
193
195#line 39 "sqljson.pgc"
196
197 printf(
"Found json=%s\n", json);
198
200 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
202#line 42 "sqljson.pgc"
203
205#line 42 "sqljson.pgc"
206
207 printf(
"Found json=%s\n", json);
208
210 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
212#line 45 "sqljson.pgc"
213
215#line 45 "sqljson.pgc"
216
217 printf(
"Found json=%s\n", json);
218
220 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
222#line 48 "sqljson.pgc"
223
225#line 48 "sqljson.pgc"
226
227
228
230 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
232#line 51 "sqljson.pgc"
233
235#line 51 "sqljson.pgc"
236
237 printf(
"Found json=%s\n", json);
238
240#line 54 "sqljson.pgc"
241
243#line 54 "sqljson.pgc"
244
245
246
248 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
250#line 57 "sqljson.pgc"
251
253#line 57 "sqljson.pgc"
254
255 printf(
"Found json=%s\n", json);
256
258 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
260#line 60 "sqljson.pgc"
261
263#line 60 "sqljson.pgc"
264
265
266
268 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
270#line 63 "sqljson.pgc"
271
273#line 63 "sqljson.pgc"
274
275 printf(
"Found json=%s\n", json);
276
278 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
280#line 66 "sqljson.pgc"
281
283#line 66 "sqljson.pgc"
284
285 printf(
"Found json=%s\n", json);
286
288 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
290#line 69 "sqljson.pgc"
291
293#line 69 "sqljson.pgc"
294
295 printf(
"Found json=%s\n", json);
296
298 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
300#line 72 "sqljson.pgc"
301
303#line 72 "sqljson.pgc"
304
305 printf(
"Found json=%s\n", json);
306
308 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
310#line 75 "sqljson.pgc"
311
313#line 75 "sqljson.pgc"
314
315 printf(
"Found json=%s\n", json);
316
318 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
320#line 78 "sqljson.pgc"
321
323#line 78 "sqljson.pgc"
324
325 printf(
"Found json=%s\n", json);
326
328 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
330#line 81 "sqljson.pgc"
331
333#line 81 "sqljson.pgc"
334
335 printf(
"Found json=%s\n", json);
336
338 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
340#line 84 "sqljson.pgc"
341
343#line 84 "sqljson.pgc"
344
345 printf(
"Found json=%s\n", json);
346
348 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
350#line 87 "sqljson.pgc"
351
353#line 87 "sqljson.pgc"
354
355 printf(
"Found json=%s\n", json);
356
358 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
360#line 90 "sqljson.pgc"
361
363#line 90 "sqljson.pgc"
364
365 printf(
"Found json=%s\n", json);
366
368 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
370#line 93 "sqljson.pgc"
371
373#line 93 "sqljson.pgc"
374
375 printf(
"Found json=%s\n", json);
376
378 ECPGt_char,(json),(
long)1024,(
long)1,(1024)*
sizeof(
char),
380#line 96 "sqljson.pgc"
381
383#line 96 "sqljson.pgc"
384
385 printf(
"Found json=%s\n", json);
386
388#line 99 "sqljson.pgc"
389
391#line 99 "sqljson.pgc"
392
393
394
395 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"with val ( js ) as ( values ( '{ \"a\": 1, \"b\": [{ \"a\": 1, \"b\": 0, \"a\": 2 }] }' ) ) select js is json \"IS JSON\" , js is not json \"IS NOT JSON\" , js is json value \"IS VALUE\" , js is json object \"IS OBJECT\" , js is json array \"IS ARRAY\" , js is json scalar \"IS SCALAR\" , js is json without unique keys \"WITHOUT UNIQUE\" , js is json with unique keys \"WITH UNIQUE\" from val",
ECPGt_EOIT,
396 ECPGt_bool,&(is_json[0]),(
long)1,(
long)1,
sizeof(
bool),
398 ECPGt_bool,&(is_json[1]),(
long)1,(
long)1,
sizeof(
bool),
400 ECPGt_bool,&(is_json[2]),(
long)1,(
long)1,
sizeof(
bool),
402 ECPGt_bool,&(is_json[3]),(
long)1,(
long)1,
sizeof(
bool),
404 ECPGt_bool,&(is_json[4]),(
long)1,(
long)1,
sizeof(
bool),
406 ECPGt_bool,&(is_json[5]),(
long)1,(
long)1,
sizeof(
bool),
408 ECPGt_bool,&(is_json[6]),(
long)1,(
long)1,
sizeof(
bool),
410 ECPGt_bool,&(is_json[7]),(
long)1,(
long)1,
sizeof(
bool),
412#line 114 "sqljson.pgc"
413
415#line 114 "sqljson.pgc"
416
417 for (
int i = 0;
i <
sizeof(is_json);
i++)
418 printf(
"Found is_json[%d]: %s\n",
i, is_json[
i] ?
"true" :
"false");
419
421#line 118 "sqljson.pgc"
422
424#line 118 "sqljson.pgc"
425
426
427 return 0;
428}
bool ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
bool ECPGdisconnect(int lineno, const char *connection_name)
bool ECPGconnect(int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
bool ECPGdo(const int lineno, const int compat, const int force_indicator, const char *connection_name, const bool questionmarks, const int st, const char *query,...)