diff options
Diffstat (limited to 'src/interfaces/ecpg/test/thread/thread.pgc')
-rw-r--r-- | src/interfaces/ecpg/test/thread/thread.pgc | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/interfaces/ecpg/test/thread/thread.pgc b/src/interfaces/ecpg/test/thread/thread.pgc index 58763564abf..e7f0b4d1dca 100644 --- a/src/interfaces/ecpg/test/thread/thread.pgc +++ b/src/interfaces/ecpg/test/thread/thread.pgc @@ -3,19 +3,18 @@ * by Philip Yarra & Lee Kindness. */ #include <stdlib.h> +#include "ecpg_config.h" + #ifndef ENABLE_THREAD_SAFETY int main(void) { - printf("Success.\n"); + printf("No threading enabled.\n"); return 0; } #else #include <pthread.h> -#undef DEBUG - - exec sql include ../regression; void *test_thread(void *arg); @@ -31,11 +30,9 @@ int main(int argc, char *argv[]) int l_rows; EXEC SQL END DECLARE SECTION; - - /* Switch off debug output for regression tests. The threads get executed in + /* Do not switch on debug output for regression tests. The threads get executed in * more or less random order */ - ECPGdebug(0, stderr); - + /* ECPGdebug(1, stderr); */ /* setup test_thread table */ EXEC SQL CONNECT TO REGRESSDB1; @@ -103,24 +100,14 @@ void *test_thread(void *arg) /* insert into test_thread table */ for( l_i = 1; l_i <= iterations; l_i++ ) { -#ifdef DEBUG - printf("%s: inserting %d\n", l_connection, l_i); -#endif EXEC SQL AT :l_connection INSERT INTO test_thread(thread, iteration) VALUES(:l_connection, :l_i); -#ifdef DEBUG - if( sqlca.sqlcode == 0 ) - printf("%s: insert done\n", l_connection); - else + if( sqlca.sqlcode != 0 ) printf("%s: ERROR: insert failed!\n", l_connection); -#endif } /* all done */ EXEC SQL AT :l_connection COMMIT; EXEC SQL DISCONNECT :l_connection; -#ifdef DEBUG - printf("%s: done!\n", l_connection); -#endif return( NULL ); } #endif /* ENABLE_THREAD_SAFETY */ |