PostgreSQL Source Code git master
sql-sqljson_jsontable.c
Go to the documentation of this file.
1/* Processed by ecpg (regression mode) */
2/* These include files are added by the preprocessor */
3#include <ecpglib.h>
4#include <ecpgerrno.h>
5#include <sqlca.h>
6/* End of automatic include section */
7#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
8
9#line 1 "sqljson_jsontable.pgc"
10#include <stdio.h>
11
12
13#line 1 "sqlca.h"
14#ifndef POSTGRES_SQLCA_H
15#define POSTGRES_SQLCA_H
16
17#ifndef PGDLLIMPORT
18#if defined(WIN32) || defined(__CYGWIN__)
19#define PGDLLIMPORT __declspec (dllimport)
20#else
21#define PGDLLIMPORT
22#endif /* __CYGWIN__ */
23#endif /* PGDLLIMPORT */
24
25#define SQLERRMC_LEN 150
26
27#ifdef __cplusplus
28extern "C"
29{
30#endif
31
32struct sqlca_t
33{
34 char sqlcaid[8];
35 long sqlabc;
36 long sqlcode;
37 struct
38 {
39 int sqlerrml;
42 char sqlerrp[8];
43 long sqlerrd[6];
44 /* Element 0: empty */
45 /* 1: OID of processed tuple if applicable */
46 /* 2: number of rows processed */
47 /* after an INSERT, UPDATE or */
48 /* DELETE statement */
49 /* 3: empty */
50 /* 4: empty */
51 /* 5: empty */
52 char sqlwarn[8];
53 /* Element 0: set to 'W' if at least one other is 'W' */
54 /* 1: if 'W' at least one character string */
55 /* value was truncated when it was */
56 /* stored into a host variable. */
57
58 /*
59 * 2: if 'W' a (hopefully) non-fatal notice occurred
60 */ /* 3: empty */
61 /* 4: empty */
62 /* 5: empty */
63 /* 6: empty */
64 /* 7: empty */
65
66 char sqlstate[5];
67};
68
69struct sqlca_t *ECPGget_sqlca(void);
70
71#ifndef POSTGRES_ECPG_INTERNAL
72#define sqlca (*ECPGget_sqlca())
73#endif
74
75#ifdef __cplusplus
76}
77#endif
78
79#endif
80
81#line 3 "sqljson_jsontable.pgc"
82
83
84#line 1 "regression.h"
85
86
87
88
89
90
91#line 4 "sqljson_jsontable.pgc"
92
93
94/* exec sql whenever sqlerror sqlprint ; */
95#line 6 "sqljson_jsontable.pgc"
96
97
98int
100{
101/* exec sql begin declare section */
102
103
104#line 12 "sqljson_jsontable.pgc"
105 int foo ;
106/* exec sql end declare section */
107#line 13 "sqljson_jsontable.pgc"
108
109
110 ECPGdebug (1, stderr);
111
112 { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
113#line 17 "sqljson_jsontable.pgc"
114
115if (sqlca.sqlcode < 0) sqlprint();}
116#line 17 "sqljson_jsontable.pgc"
117
118 { ECPGsetcommit(__LINE__, "on", NULL);
119#line 18 "sqljson_jsontable.pgc"
120
121if (sqlca.sqlcode < 0) sqlprint();}
122#line 18 "sqljson_jsontable.pgc"
123
124
125 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select foo from json_table ( jsonb '[{\"foo\":1}]' , '$[*]' as p0 columns ( foo int ) ) jt ( foo )", ECPGt_EOIT,
126 ECPGt_int,&(foo),(long)1,(long)1,sizeof(int),
127 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
128#line 23 "sqljson_jsontable.pgc"
129
130if (sqlca.sqlcode < 0) sqlprint();}
131#line 23 "sqljson_jsontable.pgc"
132
133 printf("Found foo=%d\n", foo);
134
135 { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select foo from json_table ( jsonb '[{\"foo\":\"1\"}]' , '$[*]' as p0 columns ( nested '$' as p1 columns ( nested path '$' as p11 columns ( foo int ) ) ) ) jt ( foo )", ECPGt_EOIT,
136 ECPGt_int,&(foo),(long)1,(long)1,sizeof(int),
137 ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
138#line 31 "sqljson_jsontable.pgc"
139
140if (sqlca.sqlcode < 0) sqlprint();}
141#line 31 "sqljson_jsontable.pgc"
142
143 printf("Found foo=%d\n", foo);
144
145 { ECPGdisconnect(__LINE__, "CURRENT");
146#line 34 "sqljson_jsontable.pgc"
147
148if (sqlca.sqlcode < 0) sqlprint();}
149#line 34 "sqljson_jsontable.pgc"
150
151
152 return 0;
153}
bool ECPGsetcommit(int lineno, const char *mode, const char *connection_name)
Definition: connect.c:153
bool ECPGdisconnect(int lineno, const char *connection_name)
Definition: connect.c:676
bool ECPGconnect(int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
Definition: connect.c:255
@ ECPGst_normal
Definition: ecpgtype.h:97
@ ECPGt_EOIT
Definition: ecpgtype.h:62
@ ECPGt_int
Definition: ecpgtype.h:44
@ ECPGt_NO_INDICATOR
Definition: ecpgtype.h:64
@ ECPGt_EORT
Definition: ecpgtype.h:63
void sqlprint(void)
Definition: error.c:334
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,...)
Definition: execute.c:2275
#define printf(...)
Definition: port.h:245
struct sqlca_t * ECPGget_sqlca(void)
Definition: misc.c:108
#define SQLERRMC_LEN
#define sqlca
#define ECPGdebug(X, Y)
int main()
Definition: sqlca.h:20
struct sqlca_t::@165 sqlerrm
char sqlerrp[8]
Definition: sqlca.h:29
long sqlerrd[6]
Definition: sqlca.h:30
char sqlstate[5]
Definition: sqlca.h:53
char sqlwarn[8]
Definition: sqlca.h:39
long sqlabc
Definition: sqlca.h:22
char sqlcaid[8]
Definition: sqlca.h:21
char sqlerrmc[SQLERRMC_LEN]
Definition: sqlca.h:27
long sqlcode
Definition: sqlca.h:23
int sqlerrml
Definition: sqlca.h:26