#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <process.h>
+#include <locale.h>
#else
#include <pthread.h>
#endif
#endif
-#line 24 "alloc.pgc"
+#line 25 "alloc.pgc"
#line 1 "regression.h"
-#line 25 "alloc.pgc"
+#line 26 "alloc.pgc"
/* exec sql whenever sqlerror sqlprint ; */
-#line 27 "alloc.pgc"
+#line 28 "alloc.pgc"
/* exec sql whenever not found sqlprint ; */
-#line 28 "alloc.pgc"
+#line 29 "alloc.pgc"
#ifdef WIN32
{
int i;
+#ifdef WIN32
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+#endif
+
/* exec sql begin declare section */
-#line 39 "alloc.pgc"
+#line 44 "alloc.pgc"
int value ;
-#line 40 "alloc.pgc"
+#line 45 "alloc.pgc"
char name [ 100 ] ;
-#line 41 "alloc.pgc"
+#line 46 "alloc.pgc"
char ** r = NULL ;
/* exec sql end declare section */
-#line 42 "alloc.pgc"
+#line 47 "alloc.pgc"
value = (long)arg;
sprintf(name, "Connection: %d", value);
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , name, 0);
-#line 47 "alloc.pgc"
+#line 52 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 47 "alloc.pgc"
+#line 52 "alloc.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
-#line 48 "alloc.pgc"
+#line 53 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 48 "alloc.pgc"
+#line 53 "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 51 "alloc.pgc"
+#line 56 "alloc.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
-#line 51 "alloc.pgc"
+#line 56 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 51 "alloc.pgc"
+#line 56 "alloc.pgc"
free(r);
r = NULL;
}
{ ECPGdisconnect(__LINE__, name);
-#line 55 "alloc.pgc"
+#line 60 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 55 "alloc.pgc"
+#line 60 "alloc.pgc"
return 0;
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <process.h>
+#include <locale.h>
#else
#include <pthread.h>
#endif
#endif
-#line 15 "descriptor.pgc"
+#line 16 "descriptor.pgc"
/* exec sql whenever sqlerror sqlprint ; */
-#line 16 "descriptor.pgc"
+#line 17 "descriptor.pgc"
/* exec sql whenever not found sqlprint ; */
-#line 17 "descriptor.pgc"
+#line 18 "descriptor.pgc"
#if defined(ENABLE_THREAD_SAFETY) && defined(WIN32)
{
int i;
+#ifdef WIN32
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+#endif
+
for (i = 1; i <= REPEATS; ++i)
{
ECPGallocate_desc(__LINE__, "mydesc");
-#line 29 "descriptor.pgc"
+#line 34 "descriptor.pgc"
if (sqlca.sqlcode < 0) sqlprint();
-#line 29 "descriptor.pgc"
+#line 34 "descriptor.pgc"
ECPGdeallocate_desc(__LINE__, "mydesc");
-#line 30 "descriptor.pgc"
+#line 35 "descriptor.pgc"
if (sqlca.sqlcode < 0) sqlprint();
-#line 30 "descriptor.pgc"
+#line 35 "descriptor.pgc"
}
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <process.h>
+#include <locale.h>
#else
#include <pthread.h>
#endif
#endif
-#line 24 "prep.pgc"
+#line 25 "prep.pgc"
#line 1 "regression.h"
-#line 25 "prep.pgc"
+#line 26 "prep.pgc"
/* exec sql whenever sqlerror sqlprint ; */
-#line 27 "prep.pgc"
+#line 28 "prep.pgc"
/* exec sql whenever not found sqlprint ; */
-#line 28 "prep.pgc"
+#line 29 "prep.pgc"
#ifdef WIN32
{
int i;
+#ifdef WIN32
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+#endif
+
/* exec sql begin declare section */
-#line 39 "prep.pgc"
+#line 44 "prep.pgc"
int value ;
-#line 40 "prep.pgc"
+#line 45 "prep.pgc"
char name [ 100 ] ;
-#line 41 "prep.pgc"
+#line 46 "prep.pgc"
char query [ 256 ] = "INSERT INTO T VALUES ( ? )" ;
/* exec sql end declare section */
-#line 42 "prep.pgc"
+#line 47 "prep.pgc"
value = (long)arg;
sprintf(name, "Connection: %d", value);
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , name, 0);
-#line 47 "prep.pgc"
+#line 52 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 47 "prep.pgc"
+#line 52 "prep.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
-#line 48 "prep.pgc"
+#line 53 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 48 "prep.pgc"
+#line 53 "prep.pgc"
for (i = 1; i <= REPEATS; ++i)
{
{ ECPGprepare(__LINE__, NULL, 0, "i", query);
-#line 51 "prep.pgc"
+#line 56 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 51 "prep.pgc"
+#line 56 "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 52 "prep.pgc"
+#line 57 "prep.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
-#line 52 "prep.pgc"
+#line 57 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 52 "prep.pgc"
+#line 57 "prep.pgc"
}
{ ECPGdeallocate(__LINE__, 0, NULL, "i");
-#line 54 "prep.pgc"
+#line 59 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 54 "prep.pgc"
+#line 59 "prep.pgc"
{ ECPGdisconnect(__LINE__, name);
-#line 55 "prep.pgc"
+#line 60 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 55 "prep.pgc"
+#line 60 "prep.pgc"
return 0;
#endif
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
-#line 69 "prep.pgc"
+#line 74 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 69 "prep.pgc"
+#line 74 "prep.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
-#line 70 "prep.pgc"
+#line 75 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 70 "prep.pgc"
+#line 75 "prep.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table if exists T", ECPGt_EOIT, ECPGt_EORT);
-#line 71 "prep.pgc"
+#line 76 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 71 "prep.pgc"
+#line 76 "prep.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( i int )", ECPGt_EOIT, ECPGt_EORT);
-#line 72 "prep.pgc"
+#line 77 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 72 "prep.pgc"
+#line 77 "prep.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
-#line 73 "prep.pgc"
+#line 78 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 73 "prep.pgc"
+#line 78 "prep.pgc"
#ifdef WIN32
#include <pthread.h>
#else
#include <windows.h>
+#include <locale.h>
#endif
-#line 22 "thread.pgc"
+#line 23 "thread.pgc"
void *test_thread(void *arg);
/* exec sql begin declare section */
-#line 38 "thread.pgc"
+#line 39 "thread.pgc"
int l_rows ;
/* exec sql end declare section */
-#line 39 "thread.pgc"
+#line 40 "thread.pgc"
/* Do not switch on debug output for regression tests. The threads get executed in
/* setup test_thread table */
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
-#line 46 "thread.pgc"
+#line 47 "thread.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test_thread", ECPGt_EOIT, ECPGt_EORT);}
-#line 47 "thread.pgc"
+#line 48 "thread.pgc"
/* DROP might fail */
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 48 "thread.pgc"
+#line 49 "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 53 "thread.pgc"
+#line 54 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 54 "thread.pgc"
+#line 55 "thread.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 55 "thread.pgc"
+#line 56 "thread.pgc"
/* create, and start, threads */
/* and check results */
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
-#line 85 "thread.pgc"
+#line 86 "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 86 "thread.pgc"
+#line 87 "thread.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 87 "thread.pgc"
+#line 88 "thread.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 88 "thread.pgc"
+#line 89 "thread.pgc"
if( l_rows == (nthreads * iterations) )
printf("Success.\n");
void *test_thread(void *arg)
{
long threadnum = (long)arg;
+
+#ifdef WIN32
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+#endif
+
/* exec sql begin declare section */
-#line 101 "thread.pgc"
+#line 107 "thread.pgc"
int l_i ;
-#line 102 "thread.pgc"
+#line 108 "thread.pgc"
char l_connection [ 128 ] ;
/* exec sql end declare section */
-#line 103 "thread.pgc"
+#line 109 "thread.pgc"
/* build up connection name, and connect to database */
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#endif
/* exec sql whenever sqlerror sqlprint ; */
-#line 111 "thread.pgc"
+#line 117 "thread.pgc"
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , l_connection, 0);
-#line 112 "thread.pgc"
+#line 118 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 112 "thread.pgc"
+#line 118 "thread.pgc"
if( sqlca.sqlcode != 0 )
{
return( NULL );
}
{ ECPGtrans(__LINE__, l_connection, "begin");
-#line 118 "thread.pgc"
+#line 124 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 118 "thread.pgc"
+#line 124 "thread.pgc"
/* insert into test_thread table */
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 123 "thread.pgc"
+#line 129 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 123 "thread.pgc"
+#line 129 "thread.pgc"
if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
/* all done */
{ ECPGtrans(__LINE__, l_connection, "commit");
-#line 129 "thread.pgc"
+#line 135 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 129 "thread.pgc"
+#line 135 "thread.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
-#line 130 "thread.pgc"
+#line 136 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 130 "thread.pgc"
+#line 136 "thread.pgc"
return( NULL );
}
#include <pthread.h>
#else
#include <windows.h>
+#include <locale.h>
#endif
-#line 23 "thread_implicit.pgc"
+#line 24 "thread_implicit.pgc"
void *test_thread(void *arg);
/* exec sql begin declare section */
-#line 39 "thread_implicit.pgc"
+#line 40 "thread_implicit.pgc"
int l_rows ;
/* exec sql end declare section */
-#line 40 "thread_implicit.pgc"
+#line 41 "thread_implicit.pgc"
/* Do not switch on debug output for regression tests. The threads get executed in
/* setup test_thread table */
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
-#line 47 "thread_implicit.pgc"
+#line 48 "thread_implicit.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test_thread", ECPGt_EOIT, ECPGt_EORT);}
-#line 48 "thread_implicit.pgc"
+#line 49 "thread_implicit.pgc"
/* DROP might fail */
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 49 "thread_implicit.pgc"
+#line 50 "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 54 "thread_implicit.pgc"
+#line 55 "thread_implicit.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 55 "thread_implicit.pgc"
+#line 56 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 56 "thread_implicit.pgc"
+#line 57 "thread_implicit.pgc"
/* create, and start, threads */
/* and check results */
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0); }
-#line 86 "thread_implicit.pgc"
+#line 87 "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 87 "thread_implicit.pgc"
+#line 88 "thread_implicit.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 88 "thread_implicit.pgc"
+#line 89 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 89 "thread_implicit.pgc"
+#line 90 "thread_implicit.pgc"
if( l_rows == (nthreads * iterations) )
printf("Success.\n");
void *test_thread(void *arg)
{
long threadnum = (long)arg;
+
+#ifdef WIN32
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+#endif
+
/* exec sql begin declare section */
-#line 102 "thread_implicit.pgc"
+#line 108 "thread_implicit.pgc"
int l_i ;
-#line 103 "thread_implicit.pgc"
+#line 109 "thread_implicit.pgc"
char l_connection [ 128 ] ;
/* exec sql end declare section */
-#line 104 "thread_implicit.pgc"
+#line 110 "thread_implicit.pgc"
/* build up connection name, and connect to database */
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#endif
/* exec sql whenever sqlerror sqlprint ; */
-#line 112 "thread_implicit.pgc"
+#line 118 "thread_implicit.pgc"
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , l_connection, 0);
-#line 113 "thread_implicit.pgc"
+#line 119 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 113 "thread_implicit.pgc"
+#line 119 "thread_implicit.pgc"
if( sqlca.sqlcode != 0 )
{
return( NULL );
}
{ ECPGtrans(__LINE__, NULL, "begin");
-#line 119 "thread_implicit.pgc"
+#line 125 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 119 "thread_implicit.pgc"
+#line 125 "thread_implicit.pgc"
/* insert into test_thread table */
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 124 "thread_implicit.pgc"
+#line 130 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 124 "thread_implicit.pgc"
+#line 130 "thread_implicit.pgc"
if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
/* all done */
{ ECPGtrans(__LINE__, NULL, "commit");
-#line 130 "thread_implicit.pgc"
+#line 136 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 130 "thread_implicit.pgc"
+#line 136 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
-#line 131 "thread_implicit.pgc"
+#line 137 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
-#line 131 "thread_implicit.pgc"
+#line 137 "thread_implicit.pgc"
return( NULL );
}
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <process.h>
+#include <locale.h>
#else
#include <pthread.h>
#endif
{
int i;
+#ifdef WIN32
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+#endif
+
EXEC SQL BEGIN DECLARE SECTION;
int value;
char name[100];
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <process.h>
+#include <locale.h>
#else
#include <pthread.h>
#endif
{
int i;
+#ifdef WIN32
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+#endif
+
for (i = 1; i <= REPEATS; ++i)
{
EXEC SQL ALLOCATE DESCRIPTOR mydesc;
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <process.h>
+#include <locale.h>
#else
#include <pthread.h>
#endif
{
int i;
+#ifdef WIN32
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+#endif
+
EXEC SQL BEGIN DECLARE SECTION;
int value;
char name[100];
#include <pthread.h>
#else
#include <windows.h>
+#include <locale.h>
#endif
exec sql include ../regression;
void *test_thread(void *arg)
{
long threadnum = (long)arg;
+
+#ifdef WIN32
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+#endif
+
EXEC SQL BEGIN DECLARE SECTION;
int l_i;
char l_connection[128];
#include <pthread.h>
#else
#include <windows.h>
+#include <locale.h>
#endif
exec sql include ../regression;
void *test_thread(void *arg)
{
long threadnum = (long)arg;
+
+#ifdef WIN32
+ _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
+#endif
+
EXEC SQL BEGIN DECLARE SECTION;
int l_i;
char l_connection[128];