PostgreSQL Source Code  git master
sql-show.c File Reference
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for sql-show.c:

Go to the source code of this file.

Macros

#define ECPGdebug(X, Y)   ECPGdebug((X)+100,(Y))
 

Functions

int main ()
 

Macro Definition Documentation

◆ ECPGdebug

#define ECPGdebug (   X,
 
)    ECPGdebug((X)+100,(Y))

Definition at line 7 of file sql-show.c.

Function Documentation

◆ main()

int main ( void  )

Definition at line 25 of file sql-show.c.

25  {
26  /* exec sql begin declare section */
27 
28 
29 #line 9 "show.pgc"
30  char var [ 25 ] = "public" ;
31 /* exec sql end declare section */
32 #line 10 "show.pgc"
33 
34 
35  ECPGdebug(1, stderr);
36  { ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
37 #line 13 "show.pgc"
38 
39 
40  /* exec sql whenever sql_warning sqlprint ; */
41 #line 15 "show.pgc"
42 
43  /* exec sql whenever sqlerror sqlprint ; */
44 #line 16 "show.pgc"
45 
46 
47  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set search_path to $0",
48  ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
49  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
50 #line 18 "show.pgc"
51 
52 if (sqlca.sqlwarn[0] == 'W') sqlprint();
53 #line 18 "show.pgc"
54 
55 if (sqlca.sqlcode < 0) sqlprint();}
56 #line 18 "show.pgc"
57 
58  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show search_path", ECPGt_EOIT,
59  ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
60  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
61 #line 19 "show.pgc"
62 
63 if (sqlca.sqlwarn[0] == 'W') sqlprint();
64 #line 19 "show.pgc"
65 
66 if (sqlca.sqlcode < 0) sqlprint();}
67 #line 19 "show.pgc"
68 
69  printf("Var: Search path: %s\n", var);
70 
71  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set search_path to 'public'", ECPGt_EOIT, ECPGt_EORT);
72 #line 22 "show.pgc"
73 
74 if (sqlca.sqlwarn[0] == 'W') sqlprint();
75 #line 22 "show.pgc"
76 
77 if (sqlca.sqlcode < 0) sqlprint();}
78 #line 22 "show.pgc"
79 
80  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show search_path", ECPGt_EOIT,
81  ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
82  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
83 #line 23 "show.pgc"
84 
85 if (sqlca.sqlwarn[0] == 'W') sqlprint();
86 #line 23 "show.pgc"
87 
88 if (sqlca.sqlcode < 0) sqlprint();}
89 #line 23 "show.pgc"
90 
91  printf("Var: Search path: %s\n", var);
92 
93  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set standard_conforming_strings to off", ECPGt_EOIT, ECPGt_EORT);
94 #line 26 "show.pgc"
95 
96 if (sqlca.sqlwarn[0] == 'W') sqlprint();
97 #line 26 "show.pgc"
98 
99 if (sqlca.sqlcode < 0) sqlprint();}
100 #line 26 "show.pgc"
101 
102  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show standard_conforming_strings", ECPGt_EOIT,
103  ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
104  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
105 #line 27 "show.pgc"
106 
107 if (sqlca.sqlwarn[0] == 'W') sqlprint();
108 #line 27 "show.pgc"
109 
110 if (sqlca.sqlcode < 0) sqlprint();}
111 #line 27 "show.pgc"
112 
113  printf("Var: Standard conforming strings: %s\n", var);
114 
115  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set time zone PST8PDT", ECPGt_EOIT, ECPGt_EORT);
116 #line 30 "show.pgc"
117 
118 if (sqlca.sqlwarn[0] == 'W') sqlprint();
119 #line 30 "show.pgc"
120 
121 if (sqlca.sqlcode < 0) sqlprint();}
122 #line 30 "show.pgc"
123 
124  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show time zone", ECPGt_EOIT,
125  ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
126  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
127 #line 31 "show.pgc"
128 
129 if (sqlca.sqlwarn[0] == 'W') sqlprint();
130 #line 31 "show.pgc"
131 
132 if (sqlca.sqlcode < 0) sqlprint();}
133 #line 31 "show.pgc"
134 
135  printf("Time Zone: %s\n", var);
136 
137  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set transaction isolation level read committed", ECPGt_EOIT, ECPGt_EORT);
138 #line 34 "show.pgc"
139 
140 if (sqlca.sqlwarn[0] == 'W') sqlprint();
141 #line 34 "show.pgc"
142 
143 if (sqlca.sqlcode < 0) sqlprint();}
144 #line 34 "show.pgc"
145 
146  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "show transaction isolation level", ECPGt_EOIT,
147  ECPGt_char,(var),(long)25,(long)1,(25)*sizeof(char),
148  ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
149 #line 35 "show.pgc"
150 
151 if (sqlca.sqlwarn[0] == 'W') sqlprint();
152 #line 35 "show.pgc"
153 
154 if (sqlca.sqlcode < 0) sqlprint();}
155 #line 35 "show.pgc"
156 
157  printf("Transaction isolation level: %s\n", var);
158 
159  { ECPGdisconnect(__LINE__, "ALL");
160 #line 38 "show.pgc"
161 
162 if (sqlca.sqlwarn[0] == 'W') sqlprint();
163 #line 38 "show.pgc"
164 
165 if (sqlca.sqlcode < 0) sqlprint();}
166 #line 38 "show.pgc"
167 
168 
169  return 0;
170 }
bool ECPGdisconnect(int lineno, const char *connection_name)
Definition: connect.c:673
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_NO_INDICATOR
Definition: ecpgtype.h:64
@ ECPGt_EORT
Definition: ecpgtype.h:63
@ ECPGt_char
Definition: ecpgtype.h:43
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:2277
#define printf(...)
Definition: port.h:244
#define ECPGdebug(X, Y)
Definition: sql-show.c:7
#define sqlca
Definition: sqlca.h:59

References ECPGconnect(), ECPGdebug, ECPGdisconnect(), ECPGdo(), ECPGst_normal, ECPGt_char, ECPGt_EOIT, ECPGt_EORT, ECPGt_NO_INDICATOR, printf, sqlca, and sqlprint().