PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
preproc-init.c File Reference
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
Include dependency graph for preproc-init.c:

Go to the source code of this file.

Data Structures

struct  sqlca_t
 
struct  sa
 

Macros

#define ECPGdebug(X, Y)   ECPGdebug((X)+100,(Y))
 
#define POSTGRES_SQLCA_H
 
#define PGDLLIMPORT
 
#define SQLERRMC_LEN   150
 
#define sqlca   (*ECPGget_sqlca())
 
#define YES   1
 

Enumerations

enum  e { ENUM0, ENUM1 }
 

Functions

struct sqlca_tECPGget_sqlca (void)
 
static int fa (void)
 
static int fb (int x)
 
static int fc (const char *x)
 
static int fd (const char *x, int i)
 
static int fe (enum e x)
 
static void sqlnotice (char *notice, short trans)
 
int main (void)
 

Macro Definition Documentation

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

Definition at line 7 of file preproc-init.c.

Referenced by main().

#define PGDLLIMPORT

Definition at line 19 of file preproc-init.c.

#define POSTGRES_SQLCA_H

Definition at line 13 of file preproc-init.c.

#define sqlca   (*ECPGget_sqlca())

Definition at line 70 of file preproc-init.c.

Referenced by main().

#define SQLERRMC_LEN   150

Definition at line 23 of file preproc-init.c.

#define YES   1

Definition at line 126 of file preproc-init.c.

Enumeration Type Documentation

enum e
Enumerator
ENUM0 
ENUM1 

Definition at line 82 of file preproc-init.c.

82 { ENUM0, ENUM1 };

Function Documentation

struct sqlca_t* ECPGget_sqlca ( void  )

Definition at line 142 of file misc.c.

143 {
144 #ifdef ENABLE_THREAD_SAFETY
145  struct sqlca_t *sqlca;
146 
147  pthread_once(&sqlca_key_once, ecpg_sqlca_key_init);
148 
149  sqlca = pthread_getspecific(sqlca_key);
150  if (sqlca == NULL)
151  {
152  sqlca = malloc(sizeof(struct sqlca_t));
153  if (sqlca == NULL)
154  return NULL;
155  ecpg_init_sqlca(sqlca);
156  pthread_setspecific(sqlca_key, sqlca);
157  }
158  return (sqlca);
159 #else
160  return (&sqlca);
161 #endif
162 }
void ecpg_init_sqlca(struct sqlca_t *sqlca)
Definition: misc.c:99
#define malloc(a)
Definition: header.h:50
Definition: sqlca.h:19
#define NULL
Definition: c.h:229
void * pthread_getspecific(pthread_key_t key)
Definition: pthread-win32.c:29
static struct sqlca_t sqlca
Definition: misc.c:63
void pthread_setspecific(pthread_key_t key, void *val)
Definition: pthread-win32.c:24
static int fa ( void  )
static

Definition at line 85 of file preproc-init.c.

Referenced by final_filemap_cmp(), main(), and path_cmp().

86 {
87  printf("in fa\n");
88  return 2;
89 }
static int fb ( int  x)
static

Definition at line 92 of file preproc-init.c.

Referenced by final_filemap_cmp(), main(), and path_cmp().

93 {
94  printf("in fb (%d)\n", x);
95  return x;
96 }
static int fc ( const char *  x)
static

Definition at line 99 of file preproc-init.c.

Referenced by exprLocation(), main(), and transformRangeFunction().

100 {
101  printf("in fc (%s)\n", x);
102  return *x;
103 }
static int fd ( const char *  x,
int  i 
)
static

Definition at line 105 of file preproc-init.c.

References i.

Referenced by _mdfd_openseg(), AddToDataDirLockFile(), AddWaitEventToSet(), adjust_data_dir(), ApplyLogicalMappingFile(), BasicOpenFile(), be_lo_close(), be_lo_export(), be_lo_lseek(), be_lo_lseek64(), be_lo_open(), be_lo_tell(), be_lo_tell64(), be_lo_truncate(), be_lo_truncate64(), be_loread(), be_lowrite(), CheckForExternalTrigger(), CheckPointLogicalRewriteHeap(), choose_dsm_implementation(), copy_read_data(), count_usable_fds(), CreateLockFile(), DebugFileOpen(), deleteLOfd(), dir_existsfile(), dir_open_for_write(), dir_sync(), do_edit(), dsm_impl_mmap(), durable_rename(), exec_command_write(), existsTimeLineHistory(), exitArchiveRecovery(), exportFile(), FilePrefetch(), FileSync(), FileTruncate(), FileWriteback(), FindStreamingStart(), fork_process(), fsync_fname(), fsync_fname_ext(), fuzzy_open_file(), get_controlfile(), get_prompt(), GetNewRelFileNode(), heap_xlog_logical_rewrite(), importFile(), initMasks(), lo_close(), lo_export(), lo_import_internal(), lo_lseek(), lo_lseek64(), lo_open(), lo_read(), lo_tell(), lo_tell64(), lo_truncate(), lo_truncate64(), lo_truncate_internal(), lo_write(), load_relmap_file(), LogicalRepApplyLoop(), main(), mdcreate(), mdopen(), mdunlinkfork(), OpenTransientFile(), pg_current_logfile(), pid_lock_file_exists(), process_file(), qtext_load_file(), qtext_store(), ReadControlFile(), readdir(), readfile(), readRecoveryCommandFile(), readTimeLineHistory(), ReadTwoPhaseFile(), RecheckDataDirLockFile(), RecreateTwoPhaseFile(), ReorderBufferSerializeTXN(), RestoreSlotFromDisk(), RewriteControlFile(), SaveSlotToPath(), SendTimeLineHistory(), SimpleLruDoesPhysicalPageExist(), SlruPhysicalReadPage(), SlruPhysicalWritePage(), slurpFile(), SnapBuildRestore(), SnapBuildSerialize(), StartupReplicationOrigin(), StreamServerPort(), SysLogger_Start(), SysLoggerMain(), tarOpen(), TouchSocketLockFiles(), truncate_target_file(), UpdateControlFile(), write_pipe_chunks(), write_relmap_file(), WriteControlFile(), WriteEmptyXLOG(), writeTimeLineHistory(), writeTimeLineHistoryFile(), XLogArchiveForceDone(), XLogArchiveNotify(), XLogFileCopy(), XLogFileInit(), XLogFileOpen(), XLogFileRead(), and XLogFileReadAnyTLI().

106 {
107  printf("in fd (%s, %d)\n", x, i);
108  return (*x)*i;
109 }
int i
static int fe ( enum e  x)
static

Definition at line 111 of file preproc-init.c.

Referenced by foreign_expr_walker(), and main().

112 {
113  printf("in fe (%d)\n", (int) x);
114  return (int)x;
115 }
int main ( void  )

Definition at line 135 of file preproc-init.c.

References ECPGdebug, ECPGdo(), ECPGst_normal, ECPGt_EOIT, ECPGt_EORT, ENUM0, fa(), fb(), fc(), fd(), fe(), i, sa::member, NULL, sqlca, and sqlnotice().

136 {
137  struct sa x = { 14 },*y = &x;
138  /* exec sql begin declare section */
139 
140 
141 
142 
143 
144 
145 
146 
147 
148 
149 
150  /* = 1L */
151 
152 #line 60 "init.pgc"
153  int a = ( int ) 2 ;
154 
155 #line 61 "init.pgc"
156  int b = 2 + 2 ;
157 
158 #line 62 "init.pgc"
159  int b2 = ( 14 * 7 ) ;
160 
161 #line 63 "init.pgc"
162  int d = x . member ;
163 
164 #line 64 "init.pgc"
165  int g = fb ( 2 ) ;
166 
167 #line 65 "init.pgc"
168  int i = 3 ^ 1 ;
169 
170 #line 66 "init.pgc"
171  int j = 1 ? 1 : 2 ;
172 
173 #line 68 "init.pgc"
174  int e = y -> member ;
175 
176 #line 69 "init.pgc"
177  int c = 10 >> 2 ;
178 
179 #line 70 "init.pgc"
180  bool h = 2 || 1 ;
181 
182 #line 71 "init.pgc"
183  long iay ;
184 /* exec sql end declare section */
185 #line 72 "init.pgc"
186 
187 
188  int f=fa();
189 
190 #ifdef _cplusplus
191  /* exec sql begin declare section */
192  /* compile error */
193 
194 #line 78 "init.pgc"
195  int k = N : : i ;
196 /* exec sql end declare section */
197 #line 79 "init.pgc"
198 
199 #endif
200 
201  ECPGdebug(1, stderr);
202 
203  printf("%d %d %d %d %d %d %d %d %d %d %d\n", a, b, b2, c, d, e, f, g, h, i, j);
204  iay = 0;
205  printf("%ld\n", iay);
206  /* exec sql whenever sqlerror do fa ( ) ; */
207 #line 87 "init.pgc"
208 
209  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
210 #line 88 "init.pgc"
211 
212 if (sqlca.sqlcode < 0) fa ( );}
213 #line 88 "init.pgc"
214 
215  /* exec sql whenever sqlerror do fb ( 20 ) ; */
216 #line 89 "init.pgc"
217 
218  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
219 #line 90 "init.pgc"
220 
221 if (sqlca.sqlcode < 0) fb ( 20 );}
222 #line 90 "init.pgc"
223 
224  /* exec sql whenever sqlerror do fc ( \"50\" ) ; */
225 #line 91 "init.pgc"
226 
227  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
228 #line 92 "init.pgc"
229 
230 if (sqlca.sqlcode < 0) fc ( "50" );}
231 #line 92 "init.pgc"
232 
233  /* exec sql whenever sqlerror do fd ( \"50\" , 1 ) ; */
234 #line 93 "init.pgc"
235 
236  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
237 #line 94 "init.pgc"
238 
239 if (sqlca.sqlcode < 0) fd ( "50" , 1 );}
240 #line 94 "init.pgc"
241 
242  /* exec sql whenever sqlerror do fe ( ENUM0 ) ; */
243 #line 95 "init.pgc"
244 
245  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
246 #line 96 "init.pgc"
247 
248 if (sqlca.sqlcode < 0) fe ( ENUM0 );}
249 #line 96 "init.pgc"
250 
251  /* exec sql whenever sqlerror do sqlnotice ( NULL , 0 ) ; */
252 #line 97 "init.pgc"
253 
254  { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select now ( )", ECPGt_EOIT, ECPGt_EORT);
255 #line 98 "init.pgc"
256 
257 if (sqlca.sqlcode < 0) sqlnotice ( NULL , 0 );}
258 #line 98 "init.pgc"
259 
260  return 0;
261 }
static int fa(void)
Definition: preproc-init.c:85
static void sqlnotice(char *notice, short trans)
Definition: preproc-init.c:117
int member
Definition: preproc-init.c:83
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:2030
static int fc(const char *x)
Definition: preproc-init.c:99
static int fb(int x)
Definition: preproc-init.c:92
static int fd(const char *x, int i)
Definition: preproc-init.c:105
char * c
#define ECPGdebug(X, Y)
Definition: preproc-init.c:7
#define NULL
Definition: c.h:229
#define sqlca
Definition: preproc-init.c:70
e
Definition: preproc-init.c:82
static int fe(enum e x)
Definition: preproc-init.c:111
int i
static void sqlnotice ( char *  notice,
short  trans 
)
static

Definition at line 117 of file preproc-init.c.

Referenced by main().

118 {
119  if (!notice)
120  notice = "-empty-";
121  printf("in sqlnotice (%s, %d)\n", notice, trans);
122 }
static zic_t trans[TZ_MAX_LEAPS]
Definition: zic.c:382