PostgreSQL Source Code  git master
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 (const char *notice, short trans)
 
int main (void)
 

Macro Definition Documentation

◆ ECPGdebug

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

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

◆ PGDLLIMPORT

#define PGDLLIMPORT

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

◆ POSTGRES_SQLCA_H

#define POSTGRES_SQLCA_H

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

◆ sqlca

#define sqlca   (*ECPGget_sqlca())

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

◆ SQLERRMC_LEN

#define SQLERRMC_LEN   150

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

◆ YES

#define YES   1

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

Enumeration Type Documentation

◆ e

enum e
Enumerator
ENUM0 
ENUM1 

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

82 { ENUM0, ENUM1 };
@ ENUM0
Definition: preproc-init.c:82
@ ENUM1
Definition: preproc-init.c:82

Function Documentation

◆ ECPGget_sqlca()

struct sqlca_t* ECPGget_sqlca ( void  )

Definition at line 108 of file misc.c.

109 {
110  struct sqlca_t *sqlca;
111 
112  pthread_once(&sqlca_key_once, ecpg_sqlca_key_init);
113 
115  if (sqlca == NULL)
116  {
117  sqlca = malloc(sizeof(struct sqlca_t));
118  if (sqlca == NULL)
119  return NULL;
122  }
123  return sqlca;
124 }
#define malloc(a)
Definition: header.h:50
static pthread_key_t sqlca_key
Definition: misc.c:58
void ecpg_init_sqlca(struct sqlca_t *sqlca)
Definition: misc.c:67
static void ecpg_sqlca_key_init(void)
Definition: misc.c:102
static pthread_once_t sqlca_key_once
Definition: misc.c:59
void * pthread_getspecific(pthread_key_t key)
Definition: pthread-win32.c:29
void pthread_setspecific(pthread_key_t key, void *val)
Definition: pthread-win32.c:24
#define sqlca
Definition: sqlca.h:59
Definition: sqlca.h:20

◆ fa()

static int fa ( void  )
static

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

86 {
87  printf("in fa\n");
88  return 2;
89 }
#define printf(...)
Definition: port.h:244

References printf.

Referenced by final_filemap_cmp(), and main().

◆ fb()

static int fb ( int  x)
static

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

93 {
94  printf("in fb (%d)\n", x);
95  return x;
96 }
int x
Definition: isn.c:71

References printf, and x.

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

◆ fc()

static int fc ( const char *  x)
static

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

100 {
101  printf("in fc (%s)\n", x);
102  return *x;
103 }

References printf, and x.

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

◆ fd()

static int fd ( const char *  x,
int  i 
)
static

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

106 {
107  printf("in fd (%s, %d)\n", x, i);
108  return (*x)*i;
109 }
int i
Definition: isn.c:73

References i, printf, and x.

Referenced by _mdfd_openseg(), add_socket_to_set(), AddToDataDirLockFile(), AddWaitEventToSet(), adjust_data_dir(), ApplyLogicalMappingFile(), BaseBackup(), basebackup_read_file(), BasicOpenFilePerm(), bbstreamer_gzip_writer_new(), 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(), check_backup_label_files(), CheckPointLogicalRewriteHeap(), choose_dsm_implementation(), closeLOfd(), CloseTransientFile(), connect_slot(), copy_file(), copy_read_data(), count_usable_fds(), CreateDirAndVersionFile(), CreateLockFile(), d2d(), DebugFileOpen(), dir_existsfile(), dir_open_for_write(), dir_sync(), do_edit(), drain(), dsm_impl_mmap(), dsm_impl_posix(), dsm_impl_posix_resize(), durable_rename(), ensure_last_message(), exec_command_write(), existsTimeLineHistory(), exportFile(), f2d(), fdatasync(), FileFallocate(), FilePrefetch(), FileSize(), FileSync(), FileTruncate(), FileWriteback(), FileZero(), FindStreamingStart(), fork_process(), fsync_fname_ext(), get_controlfile_by_exact_path(), get_prompt(), heap_xlog_logical_rewrite(), importFile(), issue_xlog_fsync(), ListenServerPort(), 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_backup_manifest(), LogicalRepApplyLoop(), main(), mdcreate(), mdopenfork(), my_SSL_set_fd(), open_direct(), open_file_in_directory(), open_none(), OpenTransientFilePerm(), optional_setsockopt(), parse_manifest_file(), perform_base_backup(), pg_current_logfile(), pg_fdatasync(), pg_flush_data(), pg_fsync(), pg_fsync_no_writethrough(), pg_fsync_writethrough(), pg_ftruncate(), pg_pread(), pg_preadv(), pg_pwrite(), pg_pwrite_zeros(), pg_pwritev(), pg_pwritev_with_retry(), pg_truncate(), pid_lock_file_exists(), process_file(), qtext_load_file(), qtext_store(), read_controlfile(), read_file_contents(), read_file_data_into_buffer(), read_pg_version_file(), read_relmap_file(), ReadControlFile(), readdir(), readfile(), readMessageFromPipe(), readRecoverySignalFile(), readTimeLineHistory(), ReadTwoPhaseFile(), RecheckDataDirLockFile(), RecreateTwoPhaseFile(), ReorderBufferRestoreChanges(), ReorderBufferSerializeChange(), ReorderBufferSerializeTXN(), RestoreSlotFromDisk(), SaveSlotToPath(), search_directory(), sendFile(), SendTimeLineHistory(), ServerLoop(), SimpleLruDoesPhysicalPageExist(), SlruPhysicalReadPage(), SlruPhysicalWritePage(), SlruSyncFileTag(), slurp_file(), slurpFile(), SnapBuildRestore(), SnapBuildRestoreContents(), SnapBuildSerialize(), socket_has_input(), start_postmaster(), StartupReplicationOrigin(), stream_abort_internal(), subxact_info_read(), subxact_info_write(), SysLogger_Start(), SysLoggerMain(), tarOpen(), truncate_target_file(), update_controlfile(), verify_file_checksum(), write_auto_conf_file(), write_pipe_chunks(), write_relmap_file(), WriteControlFile(), WriteEmptyXLOG(), writeTimeLineHistory(), writeTimeLineHistoryFile(), XLogArchiveForceDone(), XLogArchiveNotify(), XLogFileCopy(), XLogFileInit(), XLogFileInitInternal(), XLogFileOpen(), XLogFileRead(), XLogFileReadAnyTLI(), and XLogInitNewTimeline().

◆ fe()

static int fe ( enum e  x)
static

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

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

References printf, and x.

Referenced by foreign_expr_walker(), and main().

◆ main()

int main ( void  )

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

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 }
@ ECPGst_normal
Definition: ecpgtype.h:97
@ ECPGt_EOIT
Definition: ecpgtype.h:62
@ ECPGt_EORT
Definition: ecpgtype.h:63
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
int y
Definition: isn.c:72
int b
Definition: isn.c:70
int a
Definition: isn.c:69
int j
Definition: isn.c:74
char * c
e
Definition: preproc-init.c:82
static void sqlnotice(const char *notice, short trans)
Definition: preproc-init.c:117
static int fa(void)
Definition: preproc-init.c:85
static int fd(const char *x, int i)
Definition: preproc-init.c:105
static int fb(int x)
Definition: preproc-init.c:92
static int fe(enum e x)
Definition: preproc-init.c:111
#define sqlca
Definition: preproc-init.c:70
#define ECPGdebug(X, Y)
Definition: preproc-init.c:7
static int fc(const char *x)
Definition: preproc-init.c:99
int member
Definition: preproc-init.c:83

References a, b, ECPGdebug, ECPGdo(), ECPGst_normal, ECPGt_EOIT, ECPGt_EORT, ENUM0, fa(), fb(), fc(), fd(), fe(), i, j, sa::member, printf, sqlca, sqlnotice(), x, and y.

◆ sqlnotice()

static void sqlnotice ( const char *  notice,
short  trans 
)
static

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

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:402

References printf, and trans.

Referenced by main().