summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test
diff options
context:
space:
mode:
authorThomas Munro2023-07-11 18:20:37 +0000
committerThomas Munro2023-07-11 20:20:43 +0000
commit68a4b58eca032916e2aad78d63f717dcb147e906 (patch)
treed944d9ffb794df9d70c6408475f20d20a0580080 /src/interfaces/ecpg/test
parent11f36694091c97318e5a2bd28b35ffe9aa1c3b6a (diff)
Remove --disable-thread-safety and related code.
All supported computers have either POSIX or Windows threads, and we no longer have any automated testing of --disable-thread-safety. We define a vestigial ENABLE_THREAD_SAFETY macro to 1 in ecpg_config.h in case it is useful, but we no longer test it anywhere in PostgreSQL code, and associated dead code paths are removed. The Meson and perl-based Windows build scripts never had an equivalent build option. Reviewed-by: Andres Freund <[email protected]> Reviewed-by: Peter Eisentraut <[email protected]> Reviewed-by: Heikki Linnakangas <[email protected]> Discussion: https://postgr.es/m/CA%2BhUKGLtmexrpMtxBRLCVePqV_dtWG-ZsEbyPrYc%2BNBB2TkNsw%40mail.gmail.com
Diffstat (limited to 'src/interfaces/ecpg/test')
-rw-r--r--src/interfaces/ecpg/test/expected/thread-alloc.c43
-rw-r--r--src/interfaces/ecpg/test/expected/thread-descriptor.c22
-rw-r--r--src/interfaces/ecpg/test/expected/thread-prep.c71
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread.c63
-rw-r--r--src/interfaces/ecpg/test/expected/thread-thread_implicit.c63
-rw-r--r--src/interfaces/ecpg/test/thread/alloc.pgc9
-rw-r--r--src/interfaces/ecpg/test/thread/descriptor.pgc8
-rw-r--r--src/interfaces/ecpg/test/thread/prep.pgc9
-rw-r--r--src/interfaces/ecpg/test/thread/thread.pgc9
-rw-r--r--src/interfaces/ecpg/test/thread/thread_implicit.pgc9
10 files changed, 111 insertions, 195 deletions
diff --git a/src/interfaces/ecpg/test/expected/thread-alloc.c b/src/interfaces/ecpg/test/expected/thread-alloc.c
index 37ef44ed94b..3b31d27fd34 100644
--- a/src/interfaces/ecpg/test/expected/thread-alloc.c
+++ b/src/interfaces/ecpg/test/expected/thread-alloc.c
@@ -11,14 +11,6 @@
#include <stdlib.h>
#include "ecpg_config.h"
-#ifndef ENABLE_THREAD_SAFETY
-int
-main(void)
-{
- printf("No threading enabled.\n");
- return 0;
-}
-#else
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -101,7 +93,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#endif
-#line 26 "alloc.pgc"
+#line 18 "alloc.pgc"
#line 1 "regression.h"
@@ -111,14 +103,14 @@ struct sqlca_t *ECPGget_sqlca(void);
-#line 27 "alloc.pgc"
+#line 19 "alloc.pgc"
/* exec sql whenever sqlerror sqlprint ; */
-#line 29 "alloc.pgc"
+#line 21 "alloc.pgc"
/* exec sql whenever not found sqlprint ; */
-#line 30 "alloc.pgc"
+#line 22 "alloc.pgc"
#ifdef WIN32
@@ -134,54 +126,54 @@ static void* fn(void* arg)
-#line 41 "alloc.pgc"
+#line 33 "alloc.pgc"
int value ;
-#line 42 "alloc.pgc"
+#line 34 "alloc.pgc"
char name [ 100 ] ;
-#line 43 "alloc.pgc"
+#line 35 "alloc.pgc"
char ** r = NULL ;
/* exec sql end declare section */
-#line 44 "alloc.pgc"
+#line 36 "alloc.pgc"
value = (intptr_t) arg;
sprintf(name, "Connection: %d", value);
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , name, 0);
-#line 49 "alloc.pgc"
+#line 41 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 49 "alloc.pgc"
+#line 41 "alloc.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
-#line 50 "alloc.pgc"
+#line 42 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 50 "alloc.pgc"
+#line 42 "alloc.pgc"
for (i = 1; i <= REPEATS; ++i)
{
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select relname from pg_class where relname = 'pg_class'", ECPGt_EOIT,
ECPGt_char,&(r),(long)0,(long)0,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 53 "alloc.pgc"
+#line 45 "alloc.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
-#line 53 "alloc.pgc"
+#line 45 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 53 "alloc.pgc"
+#line 45 "alloc.pgc"
free(r);
r = NULL;
}
{ ECPGdisconnect(__LINE__, name);
-#line 57 "alloc.pgc"
+#line 49 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 57 "alloc.pgc"
+#line 49 "alloc.pgc"
return 0;
@@ -215,4 +207,3 @@ int main ()
return 0;
}
-#endif
diff --git a/src/interfaces/ecpg/test/expected/thread-descriptor.c b/src/interfaces/ecpg/test/expected/thread-descriptor.c
index f56cc25ab02..e34f4708d13 100644
--- a/src/interfaces/ecpg/test/expected/thread-descriptor.c
+++ b/src/interfaces/ecpg/test/expected/thread-descriptor.c
@@ -7,7 +7,6 @@
#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
#line 1 "descriptor.pgc"
-#ifdef ENABLE_THREAD_SAFETY
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -16,7 +15,6 @@
#else
#include <pthread.h>
#endif
-#endif
#include <stdio.h>
#define THREADS 16
@@ -91,16 +89,16 @@ struct sqlca_t *ECPGget_sqlca(void);
#endif
-#line 16 "descriptor.pgc"
+#line 14 "descriptor.pgc"
/* exec sql whenever sqlerror sqlprint ; */
-#line 17 "descriptor.pgc"
+#line 15 "descriptor.pgc"
/* exec sql whenever not found sqlprint ; */
-#line 18 "descriptor.pgc"
+#line 16 "descriptor.pgc"
-#if defined(ENABLE_THREAD_SAFETY) && defined(WIN32)
+#if defined(WIN32)
static unsigned __stdcall fn(void* arg)
#else
static void* fn(void* arg)
@@ -111,16 +109,16 @@ static void* fn(void* arg)
for (i = 1; i <= REPEATS; ++i)
{
ECPGallocate_desc(__LINE__, "mydesc");
-#line 30 "descriptor.pgc"
+#line 28 "descriptor.pgc"
if (sqlca.sqlcode < 0) sqlprint();
-#line 30 "descriptor.pgc"
+#line 28 "descriptor.pgc"
ECPGdeallocate_desc(__LINE__, "mydesc");
-#line 31 "descriptor.pgc"
+#line 29 "descriptor.pgc"
if (sqlca.sqlcode < 0) sqlprint();
-#line 31 "descriptor.pgc"
+#line 29 "descriptor.pgc"
}
@@ -129,7 +127,6 @@ if (sqlca.sqlcode < 0) sqlprint();
int main ()
{
-#ifdef ENABLE_THREAD_SAFETY
int i;
#ifdef WIN32
HANDLE threads[THREADS];
@@ -153,9 +150,6 @@ int main ()
for (i = 0; i < THREADS; ++i)
pthread_join(threads[i], NULL);
#endif
-#else
- fn(NULL);
-#endif
return 0;
}
diff --git a/src/interfaces/ecpg/test/expected/thread-prep.c b/src/interfaces/ecpg/test/expected/thread-prep.c
index 7cdf2505d3f..052e27b634f 100644
--- a/src/interfaces/ecpg/test/expected/thread-prep.c
+++ b/src/interfaces/ecpg/test/expected/thread-prep.c
@@ -11,14 +11,6 @@
#include <stdlib.h>
#include "ecpg_config.h"
-#ifndef ENABLE_THREAD_SAFETY
-int
-main(void)
-{
- printf("No threading enabled.\n");
- return 0;
-}
-#else
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -101,7 +93,7 @@ struct sqlca_t *ECPGget_sqlca(void);
#endif
-#line 26 "prep.pgc"
+#line 18 "prep.pgc"
#line 1 "regression.h"
@@ -111,14 +103,14 @@ struct sqlca_t *ECPGget_sqlca(void);
-#line 27 "prep.pgc"
+#line 19 "prep.pgc"
/* exec sql whenever sqlerror sqlprint ; */
-#line 29 "prep.pgc"
+#line 21 "prep.pgc"
/* exec sql whenever not found sqlprint ; */
-#line 30 "prep.pgc"
+#line 22 "prep.pgc"
#ifdef WIN32
@@ -134,64 +126,64 @@ static void* fn(void* arg)
-#line 41 "prep.pgc"
+#line 33 "prep.pgc"
int value ;
-#line 42 "prep.pgc"
+#line 34 "prep.pgc"
char name [ 100 ] ;
-#line 43 "prep.pgc"
+#line 35 "prep.pgc"
char query [ 256 ] = "INSERT INTO T VALUES ( ? )" ;
/* exec sql end declare section */
-#line 44 "prep.pgc"
+#line 36 "prep.pgc"
value = (intptr_t) arg;
sprintf(name, "Connection: %d", value);
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , name, 0);
-#line 49 "prep.pgc"
+#line 41 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 49 "prep.pgc"
+#line 41 "prep.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
-#line 50 "prep.pgc"
+#line 42 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 50 "prep.pgc"
+#line 42 "prep.pgc"
for (i = 1; i <= REPEATS; ++i)
{
{ ECPGprepare(__LINE__, NULL, 0, "i", query);
-#line 53 "prep.pgc"
+#line 45 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 53 "prep.pgc"
+#line 45 "prep.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "i",
ECPGt_int,&(value),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 54 "prep.pgc"
+#line 46 "prep.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
-#line 54 "prep.pgc"
+#line 46 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 54 "prep.pgc"
+#line 46 "prep.pgc"
}
{ ECPGdeallocate(__LINE__, 0, NULL, "i");
-#line 56 "prep.pgc"
+#line 48 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 56 "prep.pgc"
+#line 48 "prep.pgc"
{ ECPGdisconnect(__LINE__, name);
-#line 57 "prep.pgc"
+#line 49 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 57 "prep.pgc"
+#line 49 "prep.pgc"
return 0;
@@ -207,34 +199,34 @@ int main ()
#endif
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
-#line 71 "prep.pgc"
+#line 63 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 71 "prep.pgc"
+#line 63 "prep.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
-#line 72 "prep.pgc"
+#line 64 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 72 "prep.pgc"
+#line 64 "prep.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table if exists T", ECPGt_EOIT, ECPGt_EORT);
-#line 73 "prep.pgc"
+#line 65 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 73 "prep.pgc"
+#line 65 "prep.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( i int )", ECPGt_EOIT, ECPGt_EORT);
-#line 74 "prep.pgc"
+#line 66 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 74 "prep.pgc"
+#line 66 "prep.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
-#line 75 "prep.pgc"
+#line 67 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 75 "prep.pgc"
+#line 67 "prep.pgc"
#ifdef WIN32
@@ -256,4 +248,3 @@ if (sqlca.sqlcode < 0) sqlprint();}
return 0;
}
-#endif
diff --git a/src/interfaces/ecpg/test/expected/thread-thread.c b/src/interfaces/ecpg/test/expected/thread-thread.c
index 0e75c47fab2..95faa223c20 100644
--- a/src/interfaces/ecpg/test/expected/thread-thread.c
+++ b/src/interfaces/ecpg/test/expected/thread-thread.c
@@ -15,14 +15,6 @@
#include <stdlib.h>
#include "ecpg_config.h"
-#ifndef ENABLE_THREAD_SAFETY
-int
-main(void)
-{
- printf("No threading enabled.\n");
- return 0;
-}
-#else
#ifndef WIN32
#include <pthread.h>
#else
@@ -38,7 +30,7 @@ main(void)
-#line 24 "thread.pgc"
+#line 16 "thread.pgc"
void *test_thread(void *arg);
@@ -57,10 +49,10 @@ int main()
/* exec sql begin declare section */
-#line 40 "thread.pgc"
+#line 32 "thread.pgc"
int l_rows ;
/* exec sql end declare section */
-#line 41 "thread.pgc"
+#line 33 "thread.pgc"
/* Do not switch on debug output for regression tests. The threads get executed in
@@ -69,22 +61,22 @@ int main()
/* setup test_thread table */
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
-#line 48 "thread.pgc"
+#line 40 "thread.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test_thread", ECPGt_EOIT, ECPGt_EORT);}
-#line 49 "thread.pgc"
+#line 41 "thread.pgc"
/* DROP might fail */
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 50 "thread.pgc"
+#line 42 "thread.pgc"
{ 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);}
-#line 55 "thread.pgc"
+#line 47 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 56 "thread.pgc"
+#line 48 "thread.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 57 "thread.pgc"
+#line 49 "thread.pgc"
/* create, and start, threads */
@@ -116,18 +108,18 @@ int main()
/* and check results */
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
-#line 87 "thread.pgc"
+#line 79 "thread.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from test_thread", ECPGt_EOIT,
ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
-#line 88 "thread.pgc"
+#line 80 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 89 "thread.pgc"
+#line 81 "thread.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 90 "thread.pgc"
+#line 82 "thread.pgc"
if( l_rows == (nthreads * iterations) )
printf("Success.\n");
@@ -145,13 +137,13 @@ void *test_thread(void *arg)
-#line 104 "thread.pgc"
+#line 96 "thread.pgc"
int l_i ;
-#line 105 "thread.pgc"
+#line 97 "thread.pgc"
char l_connection [ 128 ] ;
/* exec sql end declare section */
-#line 106 "thread.pgc"
+#line 98 "thread.pgc"
/* build up connection name, and connect to database */
@@ -161,13 +153,13 @@ void *test_thread(void *arg)
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#endif
/* exec sql whenever sqlerror sqlprint ; */
-#line 114 "thread.pgc"
+#line 106 "thread.pgc"
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , l_connection, 0);
-#line 115 "thread.pgc"
+#line 107 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 115 "thread.pgc"
+#line 107 "thread.pgc"
if( sqlca.sqlcode != 0 )
{
@@ -175,10 +167,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
return NULL;
}
{ ECPGtrans(__LINE__, l_connection, "begin");
-#line 121 "thread.pgc"
+#line 113 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 121 "thread.pgc"
+#line 113 "thread.pgc"
/* insert into test_thread table */
@@ -189,10 +181,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 126 "thread.pgc"
+#line 118 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 126 "thread.pgc"
+#line 118 "thread.pgc"
if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
@@ -200,17 +192,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
/* all done */
{ ECPGtrans(__LINE__, l_connection, "commit");
-#line 132 "thread.pgc"
+#line 124 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 132 "thread.pgc"
+#line 124 "thread.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
-#line 133 "thread.pgc"
+#line 125 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 133 "thread.pgc"
+#line 125 "thread.pgc"
return NULL;
}
-#endif /* ENABLE_THREAD_SAFETY */
diff --git a/src/interfaces/ecpg/test/expected/thread-thread_implicit.c b/src/interfaces/ecpg/test/expected/thread-thread_implicit.c
index 0df2794530c..7ac0297a234 100644
--- a/src/interfaces/ecpg/test/expected/thread-thread_implicit.c
+++ b/src/interfaces/ecpg/test/expected/thread-thread_implicit.c
@@ -15,14 +15,6 @@
#include <stdlib.h>
#include "ecpg_config.h"
-#ifndef ENABLE_THREAD_SAFETY
-int
-main(void)
-{
- printf("No threading enabled.\n");
- return 0;
-}
-#else
#ifndef WIN32
#include <pthread.h>
#else
@@ -38,7 +30,7 @@ main(void)
-#line 24 "thread_implicit.pgc"
+#line 16 "thread_implicit.pgc"
void *test_thread(void *arg);
@@ -57,10 +49,10 @@ int main()
/* exec sql begin declare section */
-#line 40 "thread_implicit.pgc"
+#line 32 "thread_implicit.pgc"
int l_rows ;
/* exec sql end declare section */
-#line 41 "thread_implicit.pgc"
+#line 33 "thread_implicit.pgc"
/* Do not switch on debug output for regression tests. The threads get executed in
@@ -69,22 +61,22 @@ int main()
/* setup test_thread table */
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
-#line 48 "thread_implicit.pgc"
+#line 40 "thread_implicit.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test_thread", ECPGt_EOIT, ECPGt_EORT);}
-#line 49 "thread_implicit.pgc"
+#line 41 "thread_implicit.pgc"
/* DROP might fail */
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 50 "thread_implicit.pgc"
+#line 42 "thread_implicit.pgc"
{ 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);}
-#line 55 "thread_implicit.pgc"
+#line 47 "thread_implicit.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 56 "thread_implicit.pgc"
+#line 48 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 57 "thread_implicit.pgc"
+#line 49 "thread_implicit.pgc"
/* create, and start, threads */
@@ -116,18 +108,18 @@ int main()
/* and check results */
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
-#line 87 "thread_implicit.pgc"
+#line 79 "thread_implicit.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select count ( * ) from test_thread", ECPGt_EOIT,
ECPGt_int,&(l_rows),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
-#line 88 "thread_implicit.pgc"
+#line 80 "thread_implicit.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 89 "thread_implicit.pgc"
+#line 81 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 90 "thread_implicit.pgc"
+#line 82 "thread_implicit.pgc"
if( l_rows == (nthreads * iterations) )
printf("Success.\n");
@@ -145,13 +137,13 @@ void *test_thread(void *arg)
-#line 104 "thread_implicit.pgc"
+#line 96 "thread_implicit.pgc"
int l_i ;
-#line 105 "thread_implicit.pgc"
+#line 97 "thread_implicit.pgc"
char l_connection [ 128 ] ;
/* exec sql end declare section */
-#line 106 "thread_implicit.pgc"
+#line 98 "thread_implicit.pgc"
/* build up connection name, and connect to database */
@@ -161,13 +153,13 @@ void *test_thread(void *arg)
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#endif
/* exec sql whenever sqlerror sqlprint ; */
-#line 114 "thread_implicit.pgc"
+#line 106 "thread_implicit.pgc"
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , l_connection, 0);
-#line 115 "thread_implicit.pgc"
+#line 107 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 115 "thread_implicit.pgc"
+#line 107 "thread_implicit.pgc"
if( sqlca.sqlcode != 0 )
{
@@ -175,10 +167,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
return NULL;
}
{ ECPGtrans(__LINE__, NULL, "begin");
-#line 121 "thread_implicit.pgc"
+#line 113 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 121 "thread_implicit.pgc"
+#line 113 "thread_implicit.pgc"
/* insert into test_thread table */
@@ -189,10 +181,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 126 "thread_implicit.pgc"
+#line 118 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 126 "thread_implicit.pgc"
+#line 118 "thread_implicit.pgc"
if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
@@ -200,17 +192,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
/* all done */
{ ECPGtrans(__LINE__, NULL, "commit");
-#line 132 "thread_implicit.pgc"
+#line 124 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 132 "thread_implicit.pgc"
+#line 124 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
-#line 133 "thread_implicit.pgc"
+#line 125 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 133 "thread_implicit.pgc"
+#line 125 "thread_implicit.pgc"
return NULL;
}
-#endif /* ENABLE_THREAD_SAFETY */
diff --git a/src/interfaces/ecpg/test/thread/alloc.pgc b/src/interfaces/ecpg/test/thread/alloc.pgc
index c0021a737ed..d3d35493bf9 100644
--- a/src/interfaces/ecpg/test/thread/alloc.pgc
+++ b/src/interfaces/ecpg/test/thread/alloc.pgc
@@ -2,14 +2,6 @@
#include <stdlib.h>
#include "ecpg_config.h"
-#ifndef ENABLE_THREAD_SAFETY
-int
-main(void)
-{
- printf("No threading enabled.\n");
- return 0;
-}
-#else
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -87,4 +79,3 @@ int main ()
return 0;
}
-#endif
diff --git a/src/interfaces/ecpg/test/thread/descriptor.pgc b/src/interfaces/ecpg/test/thread/descriptor.pgc
index 76a7a5dff54..30bce7c87bc 100644
--- a/src/interfaces/ecpg/test/thread/descriptor.pgc
+++ b/src/interfaces/ecpg/test/thread/descriptor.pgc
@@ -1,4 +1,3 @@
-#ifdef ENABLE_THREAD_SAFETY
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -7,7 +6,6 @@
#else
#include <pthread.h>
#endif
-#endif
#include <stdio.h>
#define THREADS 16
@@ -17,7 +15,7 @@ EXEC SQL include sqlca;
EXEC SQL whenever sqlerror sqlprint;
EXEC SQL whenever not found sqlprint;
-#if defined(ENABLE_THREAD_SAFETY) && defined(WIN32)
+#if defined(WIN32)
static unsigned __stdcall fn(void* arg)
#else
static void* fn(void* arg)
@@ -36,7 +34,6 @@ static void* fn(void* arg)
int main ()
{
-#ifdef ENABLE_THREAD_SAFETY
int i;
#ifdef WIN32
HANDLE threads[THREADS];
@@ -60,9 +57,6 @@ int main ()
for (i = 0; i < THREADS; ++i)
pthread_join(threads[i], NULL);
#endif
-#else
- fn(NULL);
-#endif
return 0;
}
diff --git a/src/interfaces/ecpg/test/thread/prep.pgc b/src/interfaces/ecpg/test/thread/prep.pgc
index d7ecfd48555..f61b31ce101 100644
--- a/src/interfaces/ecpg/test/thread/prep.pgc
+++ b/src/interfaces/ecpg/test/thread/prep.pgc
@@ -2,14 +2,6 @@
#include <stdlib.h>
#include "ecpg_config.h"
-#ifndef ENABLE_THREAD_SAFETY
-int
-main(void)
-{
- printf("No threading enabled.\n");
- return 0;
-}
-#else
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -93,4 +85,3 @@ int main ()
return 0;
}
-#endif
diff --git a/src/interfaces/ecpg/test/thread/thread.pgc b/src/interfaces/ecpg/test/thread/thread.pgc
index e7d8c00af6f..b9b9ebb441d 100644
--- a/src/interfaces/ecpg/test/thread/thread.pgc
+++ b/src/interfaces/ecpg/test/thread/thread.pgc
@@ -6,14 +6,6 @@
#include <stdlib.h>
#include "ecpg_config.h"
-#ifndef ENABLE_THREAD_SAFETY
-int
-main(void)
-{
- printf("No threading enabled.\n");
- return 0;
-}
-#else
#ifndef WIN32
#include <pthread.h>
#else
@@ -133,4 +125,3 @@ void *test_thread(void *arg)
EXEC SQL DISCONNECT :l_connection;
return NULL;
}
-#endif /* ENABLE_THREAD_SAFETY */
diff --git a/src/interfaces/ecpg/test/thread/thread_implicit.pgc b/src/interfaces/ecpg/test/thread/thread_implicit.pgc
index b4cae7e1aec..ff9b12a9437 100644
--- a/src/interfaces/ecpg/test/thread/thread_implicit.pgc
+++ b/src/interfaces/ecpg/test/thread/thread_implicit.pgc
@@ -6,14 +6,6 @@
#include <stdlib.h>
#include "ecpg_config.h"
-#ifndef ENABLE_THREAD_SAFETY
-int
-main(void)
-{
- printf("No threading enabled.\n");
- return 0;
-}
-#else
#ifndef WIN32
#include <pthread.h>
#else
@@ -133,4 +125,3 @@ void *test_thread(void *arg)
EXEC SQL DISCONNECT :l_connection;
return NULL;
}
-#endif /* ENABLE_THREAD_SAFETY */