7 #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
16 #include "ecpg_config.h"
26 #line 1 "regression.h"
63 {
ECPGconnect(__LINE__, 0,
"ecpg1_regression" , NULL, NULL , NULL, 0); }
72 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"create table test_thread ( tstamp timestamp not null default cast ( timeofday ( ) as timestamp ) , thread text not null , iteration integer not null , primary key ( thread , iteration ) )",
ECPGt_EOIT,
ECPGt_EORT);}
86 fprintf(stderr,
"Cannot alloc memory\n");
92 pthread_create(&threads[n], NULL,
test_thread, (
void *) (n + 1));
94 threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) (
void (*) (
void))
test_thread, (
void *) (n + 1), 0, NULL);
102 pthread_join(threads[n], NULL);
105 WaitForMultipleObjects(
nthreads, threads, TRUE, INFINITE);
110 {
ECPGconnect(__LINE__, 0,
"ecpg1_regression" , NULL, NULL , NULL, 0); }
111 #line 79 "thread.pgc"
114 ECPGt_int,&(l_rows),(
long)1,(
long)1,
sizeof(
int),
116 #line 80 "thread.pgc"
119 #line 81 "thread.pgc"
122 #line 82 "thread.pgc"
134 long threadnum = (intptr_t)
arg;
140 #line 96 "thread.pgc"
143 #line 97 "thread.pgc"
144 char l_connection [ 128 ] ;
146 #line 98 "thread.pgc"
151 snprintf(l_connection,
sizeof(l_connection),
"thread_%03ld", threadnum);
153 _snprintf(l_connection,
sizeof(l_connection),
"thread_%03ld", threadnum);
156 #line 106 "thread.pgc"
158 {
ECPGconnect(__LINE__, 0,
"ecpg1_regression" , NULL, NULL , l_connection, 0);
159 #line 107 "thread.pgc"
162 #line 107 "thread.pgc"
164 if(
sqlca.sqlcode != 0 )
166 printf(
"%s: ERROR: cannot connect to database!\n", l_connection);
169 {
ECPGtrans(__LINE__, l_connection,
"begin");
170 #line 113 "thread.pgc"
173 #line 113 "thread.pgc"
179 {
ECPGdo(__LINE__, 0, 1, l_connection, 0,
ECPGst_normal,
"insert into test_thread ( thread , iteration ) values ( $1 , $2 )",
180 ECPGt_char,(l_connection),(
long)128,(
long)1,(128)*
sizeof(
char),
182 ECPGt_int,&(l_i),(
long)1,(
long)1,
sizeof(
int),
184 #line 118 "thread.pgc"
187 #line 118 "thread.pgc"
189 if(
sqlca.sqlcode != 0 )
190 printf(
"%s: ERROR: insert failed!\n", l_connection);
194 {
ECPGtrans(__LINE__, l_connection,
"commit");
195 #line 124 "thread.pgc"
198 #line 124 "thread.pgc"
201 #line 125 "thread.pgc"
204 #line 125 "thread.pgc"
bool ECPGdisconnect(int lineno, const char *connection_name)
bool ECPGconnect(int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
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,...)
bool ECPGtrans(int lineno, const char *connection_name, const char *transaction)
void * test_thread(void *arg)