PostgreSQL Source Code  git master
sqlca.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sqlca_t
 

Macros

#define PGDLLIMPORT
 
#define SQLERRMC_LEN   150
 
#define sqlca   (*ECPGget_sqlca())
 

Functions

struct sqlca_tECPGget_sqlca (void)
 

Macro Definition Documentation

◆ PGDLLIMPORT

#define PGDLLIMPORT

Definition at line 8 of file sqlca.h.

◆ sqlca

◆ SQLERRMC_LEN

#define SQLERRMC_LEN   150

Definition at line 12 of file sqlca.h.

Referenced by main().

Function Documentation

◆ ECPGget_sqlca()

struct sqlca_t* ECPGget_sqlca ( void  )

Definition at line 141 of file misc.c.

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