1
/* Processed by ecpg (regression mode) */
2
/* These include files are added by the preprocessor */
6
/* End of automatic include section */
7
#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
11
#include "ecpg_config.h"
13
#ifndef ENABLE_THREAD_SAFETY
17
printf("No threading enabled.\n");
22
#define WIN32_LEAN_AND_MEAN
35
#ifndef POSTGRES_SQLCA_H
36
#define POSTGRES_SQLCA_H
39
#if defined(WIN32) || defined(__CYGWIN__)
40
#define PGDLLIMPORT __declspec (dllimport)
43
#endif /* __CYGWIN__ */
44
#endif /* PGDLLIMPORT */
46
#define SQLERRMC_LEN 150
61
char sqlerrmc[SQLERRMC_LEN];
65
/* Element 0: empty */
66
/* 1: OID of processed tuple if applicable */
67
/* 2: number of rows processed */
68
/* after an INSERT, UPDATE or */
69
/* DELETE statement */
74
/* Element 0: set to 'W' if at least one other is 'W' */
75
/* 1: if 'W' at least one character string */
76
/* value was truncated when it was */
77
/* stored into a host variable. */
80
* 2: if 'W' a (hopefully) non-fatal notice occurred
90
struct sqlca_t *ECPGget_sqlca(void);
92
#ifndef POSTGRES_ECPG_INTERNAL
93
#define sqlca (*ECPGget_sqlca())
105
#line 1 "regression.h"
115
/* exec sql whenever sqlerror sqlprint ; */
118
/* exec sql whenever not found sqlprint ; */
123
static unsigned __stdcall fn(void* arg)
125
static void* fn(void* arg)
130
/* exec sql begin declare section */
143
/* exec sql end declare section */
148
sprintf(name, "Connection: %d", value);
150
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , name, 0);
153
if (sqlca.sqlcode < 0) sqlprint();}
156
{ ECPGsetcommit(__LINE__, "on", NULL);
159
if (sqlca.sqlcode < 0) sqlprint();}
162
for (i = 1; i <= REPEATS; ++i)
164
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select relname from pg_class where relname = 'pg_class'", ECPGt_EOIT,
165
ECPGt_char,&(r),(long)0,(long)0,(1)*sizeof(char),
166
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
169
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
172
if (sqlca.sqlcode < 0) sqlprint();}
178
{ ECPGdisconnect(__LINE__, name);
181
if (sqlca.sqlcode < 0) sqlprint();}
188
int main (int argc, char** argv)
192
HANDLE threads[THREADS];
194
pthread_t threads[THREADS];
198
for (i = 0; i < THREADS; ++i)
201
threads[i] = (HANDLE)_beginthreadex(NULL, 0, fn, (void*)i, 0, &id);
204
WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE);
205
for (i = 0; i < THREADS; ++i)
206
CloseHandle(threads[i]);
208
for (i = 0; i < THREADS; ++i)
209
pthread_create(&threads[i], NULL, fn, (void *) (long) i);
210
for (i = 0; i < THREADS; ++i)
211
pthread_join(threads[i], NULL);