Remove _configthreadlocale() calls in ecpg test suite.

This essentially reverts commits a772624b1 and 04fbe0e45, which
added "_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)" calls to the
thread-related ecpg test programs.  That was nothing but a hack,
because we shouldn't expect that ecpg-using applications have
done that for us; and now that we've inserted such calls into
ecpglib, the tests should still pass without it.

(If they don't, it would be good to know that.)

HEAD only; there seems no big need to change this in the
back branches.

Discussion: https://postgr.es/m/22937.1548307384@sss.pgh.pa.us
This commit is contained in:
Tom Lane 2019-01-24 17:02:09 -05:00
parent d5a1fde397
commit e3565fd61c
10 changed files with 58 additions and 118 deletions

View File

@ -145,48 +145,42 @@ static void* fn(void* arg)
#line 43 "alloc.pgc"
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
value = (long)arg;
sprintf(name, "Connection: %d", value);
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , name, 0);
#line 54 "alloc.pgc"
#line 48 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 54 "alloc.pgc"
#line 48 "alloc.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
#line 55 "alloc.pgc"
#line 49 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 55 "alloc.pgc"
#line 49 "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 58 "alloc.pgc"
#line 52 "alloc.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
#line 58 "alloc.pgc"
#line 52 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 58 "alloc.pgc"
#line 52 "alloc.pgc"
free(r);
r = NULL;
}
{ ECPGdisconnect(__LINE__, name);
#line 62 "alloc.pgc"
#line 56 "alloc.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 62 "alloc.pgc"
#line 56 "alloc.pgc"
return 0;

View File

@ -108,25 +108,19 @@ static void* fn(void* arg)
{
int i;
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
for (i = 1; i <= REPEATS; ++i)
{
ECPGallocate_desc(__LINE__, "mydesc");
#line 36 "descriptor.pgc"
#line 30 "descriptor.pgc"
if (sqlca.sqlcode < 0) sqlprint();
#line 36 "descriptor.pgc"
#line 30 "descriptor.pgc"
ECPGdeallocate_desc(__LINE__, "mydesc");
#line 37 "descriptor.pgc"
#line 31 "descriptor.pgc"
if (sqlca.sqlcode < 0) sqlprint();
#line 37 "descriptor.pgc"
#line 31 "descriptor.pgc"
}

View File

@ -145,58 +145,52 @@ static void* fn(void* arg)
#line 43 "prep.pgc"
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
value = (long)arg;
sprintf(name, "Connection: %d", value);
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , name, 0);
#line 54 "prep.pgc"
#line 48 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 54 "prep.pgc"
#line 48 "prep.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
#line 55 "prep.pgc"
#line 49 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 55 "prep.pgc"
#line 49 "prep.pgc"
for (i = 1; i <= REPEATS; ++i)
{
{ ECPGprepare(__LINE__, NULL, 0, "i", query);
#line 58 "prep.pgc"
#line 52 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 58 "prep.pgc"
#line 52 "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 59 "prep.pgc"
#line 53 "prep.pgc"
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
#line 59 "prep.pgc"
#line 53 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 59 "prep.pgc"
#line 53 "prep.pgc"
}
{ ECPGdeallocate(__LINE__, 0, NULL, "i");
#line 61 "prep.pgc"
#line 55 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 61 "prep.pgc"
#line 55 "prep.pgc"
{ ECPGdisconnect(__LINE__, name);
#line 62 "prep.pgc"
#line 56 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 62 "prep.pgc"
#line 56 "prep.pgc"
return 0;
@ -212,34 +206,34 @@ int main ()
#endif
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
#line 76 "prep.pgc"
#line 70 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 76 "prep.pgc"
#line 70 "prep.pgc"
{ ECPGsetcommit(__LINE__, "on", NULL);
#line 77 "prep.pgc"
#line 71 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 77 "prep.pgc"
#line 71 "prep.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table if exists T", ECPGt_EOIT, ECPGt_EORT);
#line 78 "prep.pgc"
#line 72 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 78 "prep.pgc"
#line 72 "prep.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( i int )", ECPGt_EOIT, ECPGt_EORT);
#line 79 "prep.pgc"
#line 73 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 79 "prep.pgc"
#line 73 "prep.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");
#line 80 "prep.pgc"
#line 74 "prep.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 80 "prep.pgc"
#line 74 "prep.pgc"
#ifdef WIN32

View File

@ -153,12 +153,6 @@ void *test_thread(void *arg)
#line 105 "thread.pgc"
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
/* build up connection name, and connect to database */
#ifndef _MSC_VER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
@ -166,13 +160,13 @@ void *test_thread(void *arg)
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#endif
/* exec sql whenever sqlerror sqlprint ; */
#line 119 "thread.pgc"
#line 113 "thread.pgc"
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , l_connection, 0);
#line 120 "thread.pgc"
#line 114 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 120 "thread.pgc"
#line 114 "thread.pgc"
if( sqlca.sqlcode != 0 )
{
@ -180,10 +174,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
return NULL;
}
{ ECPGtrans(__LINE__, l_connection, "begin");
#line 126 "thread.pgc"
#line 120 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 126 "thread.pgc"
#line 120 "thread.pgc"
/* insert into test_thread table */
@ -194,10 +188,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 131 "thread.pgc"
#line 125 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 131 "thread.pgc"
#line 125 "thread.pgc"
if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
@ -205,16 +199,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
/* all done */
{ ECPGtrans(__LINE__, l_connection, "commit");
#line 137 "thread.pgc"
#line 131 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 137 "thread.pgc"
#line 131 "thread.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
#line 138 "thread.pgc"
#line 132 "thread.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 138 "thread.pgc"
#line 132 "thread.pgc"
return NULL;
}

View File

@ -154,12 +154,6 @@ void *test_thread(void *arg)
#line 106 "thread_implicit.pgc"
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
/* build up connection name, and connect to database */
#ifndef _MSC_VER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
@ -167,13 +161,13 @@ void *test_thread(void *arg)
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#endif
/* exec sql whenever sqlerror sqlprint ; */
#line 120 "thread_implicit.pgc"
#line 114 "thread_implicit.pgc"
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , l_connection, 0);
#line 121 "thread_implicit.pgc"
#line 115 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 121 "thread_implicit.pgc"
#line 115 "thread_implicit.pgc"
if( sqlca.sqlcode != 0 )
{
@ -181,10 +175,10 @@ if (sqlca.sqlcode < 0) sqlprint();}
return NULL;
}
{ ECPGtrans(__LINE__, NULL, "begin");
#line 127 "thread_implicit.pgc"
#line 121 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 127 "thread_implicit.pgc"
#line 121 "thread_implicit.pgc"
/* insert into test_thread table */
@ -195,10 +189,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 132 "thread_implicit.pgc"
#line 126 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 132 "thread_implicit.pgc"
#line 126 "thread_implicit.pgc"
if( sqlca.sqlcode != 0 )
printf("%s: ERROR: insert failed!\n", l_connection);
@ -206,16 +200,16 @@ if (sqlca.sqlcode < 0) sqlprint();}
/* all done */
{ ECPGtrans(__LINE__, NULL, "commit");
#line 138 "thread_implicit.pgc"
#line 132 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 138 "thread_implicit.pgc"
#line 132 "thread_implicit.pgc"
{ ECPGdisconnect(__LINE__, l_connection);
#line 139 "thread_implicit.pgc"
#line 133 "thread_implicit.pgc"
if (sqlca.sqlcode < 0) sqlprint();}
#line 139 "thread_implicit.pgc"
#line 133 "thread_implicit.pgc"
return NULL;
}

View File

@ -42,12 +42,6 @@ static void* fn(void* arg)
char **r = NULL;
EXEC SQL END DECLARE SECTION;
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
value = (long)arg;
sprintf(name, "Connection: %d", value);

View File

@ -25,12 +25,6 @@ static void* fn(void* arg)
{
int i;
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
for (i = 1; i <= REPEATS; ++i)
{
EXEC SQL ALLOCATE DESCRIPTOR mydesc;

View File

@ -42,12 +42,6 @@ static void* fn(void* arg)
char query[256] = "INSERT INTO T VALUES ( ? )";
EXEC SQL END DECLARE SECTION;
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
value = (long)arg;
sprintf(name, "Connection: %d", value);

View File

@ -104,12 +104,6 @@ void *test_thread(void *arg)
char l_connection[128];
EXEC SQL END DECLARE SECTION;
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
/* build up connection name, and connect to database */
#ifndef _MSC_VER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);

View File

@ -105,12 +105,6 @@ void *test_thread(void *arg)
char l_connection[128];
EXEC SQL END DECLARE SECTION;
#ifdef WIN32
#ifdef _MSC_VER /* requires MSVC */
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
#endif
/* build up connection name, and connect to database */
#ifndef _MSC_VER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);