Skip to content

Commit e3565fd

Browse files
committed
Remove _configthreadlocale() calls in ecpg test suite.
This essentially reverts commits a772624 and 04fbe0e, 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
1 parent d5a1fde commit e3565fd

File tree

10 files changed

+58
-118
lines changed

10 files changed

+58
-118
lines changed

src/interfaces/ecpg/test/expected/thread-alloc.c

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -145,48 +145,42 @@ static void* fn(void* arg)
145145
#line 43 "alloc.pgc"
146146

147147

148-
#ifdef WIN32
149-
#ifdef _MSC_VER /* requires MSVC */
150-
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
151-
#endif
152-
#endif
153-
154148
value = (long)arg;
155149
sprintf(name, "Connection: %d", value);
156150

157151
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , name, 0);
158-
#line 54 "alloc.pgc"
152+
#line 48 "alloc.pgc"
159153

160154
if (sqlca.sqlcode < 0) sqlprint();}
161-
#line 54 "alloc.pgc"
155+
#line 48 "alloc.pgc"
162156

163157
{ ECPGsetcommit(__LINE__, "on", NULL);
164-
#line 55 "alloc.pgc"
158+
#line 49 "alloc.pgc"
165159

166160
if (sqlca.sqlcode < 0) sqlprint();}
167-
#line 55 "alloc.pgc"
161+
#line 49 "alloc.pgc"
168162

169163
for (i = 1; i <= REPEATS; ++i)
170164
{
171165
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select relname from pg_class where relname = 'pg_class'", ECPGt_EOIT,
172166
ECPGt_char,&(r),(long)0,(long)0,(1)*sizeof(char),
173167
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
174-
#line 58 "alloc.pgc"
168+
#line 52 "alloc.pgc"
175169

176170
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
177-
#line 58 "alloc.pgc"
171+
#line 52 "alloc.pgc"
178172

179173
if (sqlca.sqlcode < 0) sqlprint();}
180-
#line 58 "alloc.pgc"
174+
#line 52 "alloc.pgc"
181175

182176
free(r);
183177
r = NULL;
184178
}
185179
{ ECPGdisconnect(__LINE__, name);
186-
#line 62 "alloc.pgc"
180+
#line 56 "alloc.pgc"
187181

188182
if (sqlca.sqlcode < 0) sqlprint();}
189-
#line 62 "alloc.pgc"
183+
#line 56 "alloc.pgc"
190184

191185

192186
return 0;

src/interfaces/ecpg/test/expected/thread-descriptor.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,19 @@ static void* fn(void* arg)
108108
{
109109
int i;
110110

111-
#ifdef WIN32
112-
#ifdef _MSC_VER /* requires MSVC */
113-
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
114-
#endif
115-
#endif
116-
117111
for (i = 1; i <= REPEATS; ++i)
118112
{
119113
ECPGallocate_desc(__LINE__, "mydesc");
120-
#line 36 "descriptor.pgc"
114+
#line 30 "descriptor.pgc"
121115

122116
if (sqlca.sqlcode < 0) sqlprint();
123-
#line 36 "descriptor.pgc"
117+
#line 30 "descriptor.pgc"
124118

125119
ECPGdeallocate_desc(__LINE__, "mydesc");
126-
#line 37 "descriptor.pgc"
120+
#line 31 "descriptor.pgc"
127121

128122
if (sqlca.sqlcode < 0) sqlprint();
129-
#line 37 "descriptor.pgc"
123+
#line 31 "descriptor.pgc"
130124

131125
}
132126

src/interfaces/ecpg/test/expected/thread-prep.c

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -145,58 +145,52 @@ static void* fn(void* arg)
145145
#line 43 "prep.pgc"
146146

147147

148-
#ifdef WIN32
149-
#ifdef _MSC_VER /* requires MSVC */
150-
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
151-
#endif
152-
#endif
153-
154148
value = (long)arg;
155149
sprintf(name, "Connection: %d", value);
156150

157151
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , name, 0);
158-
#line 54 "prep.pgc"
152+
#line 48 "prep.pgc"
159153

160154
if (sqlca.sqlcode < 0) sqlprint();}
161-
#line 54 "prep.pgc"
155+
#line 48 "prep.pgc"
162156

163157
{ ECPGsetcommit(__LINE__, "on", NULL);
164-
#line 55 "prep.pgc"
158+
#line 49 "prep.pgc"
165159

166160
if (sqlca.sqlcode < 0) sqlprint();}
167-
#line 55 "prep.pgc"
161+
#line 49 "prep.pgc"
168162

169163
for (i = 1; i <= REPEATS; ++i)
170164
{
171165
{ ECPGprepare(__LINE__, NULL, 0, "i", query);
172-
#line 58 "prep.pgc"
166+
#line 52 "prep.pgc"
173167

174168
if (sqlca.sqlcode < 0) sqlprint();}
175-
#line 58 "prep.pgc"
169+
#line 52 "prep.pgc"
176170

177171
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_execute, "i",
178172
ECPGt_int,&(value),(long)1,(long)1,sizeof(int),
179173
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
180-
#line 59 "prep.pgc"
174+
#line 53 "prep.pgc"
181175

182176
if (sqlca.sqlcode == ECPG_NOT_FOUND) sqlprint();
183-
#line 59 "prep.pgc"
177+
#line 53 "prep.pgc"
184178

185179
if (sqlca.sqlcode < 0) sqlprint();}
186-
#line 59 "prep.pgc"
180+
#line 53 "prep.pgc"
187181

188182
}
189183
{ ECPGdeallocate(__LINE__, 0, NULL, "i");
190-
#line 61 "prep.pgc"
184+
#line 55 "prep.pgc"
191185

192186
if (sqlca.sqlcode < 0) sqlprint();}
193-
#line 61 "prep.pgc"
187+
#line 55 "prep.pgc"
194188

195189
{ ECPGdisconnect(__LINE__, name);
196-
#line 62 "prep.pgc"
190+
#line 56 "prep.pgc"
197191

198192
if (sqlca.sqlcode < 0) sqlprint();}
199-
#line 62 "prep.pgc"
193+
#line 56 "prep.pgc"
200194

201195

202196
return 0;
@@ -212,34 +206,34 @@ int main ()
212206
#endif
213207

214208
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , NULL, 0);
215-
#line 76 "prep.pgc"
209+
#line 70 "prep.pgc"
216210

217211
if (sqlca.sqlcode < 0) sqlprint();}
218-
#line 76 "prep.pgc"
212+
#line 70 "prep.pgc"
219213

220214
{ ECPGsetcommit(__LINE__, "on", NULL);
221-
#line 77 "prep.pgc"
215+
#line 71 "prep.pgc"
222216

223217
if (sqlca.sqlcode < 0) sqlprint();}
224-
#line 77 "prep.pgc"
218+
#line 71 "prep.pgc"
225219

226220
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table if exists T", ECPGt_EOIT, ECPGt_EORT);
227-
#line 78 "prep.pgc"
221+
#line 72 "prep.pgc"
228222

229223
if (sqlca.sqlcode < 0) sqlprint();}
230-
#line 78 "prep.pgc"
224+
#line 72 "prep.pgc"
231225

232226
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table T ( i int )", ECPGt_EOIT, ECPGt_EORT);
233-
#line 79 "prep.pgc"
227+
#line 73 "prep.pgc"
234228

235229
if (sqlca.sqlcode < 0) sqlprint();}
236-
#line 79 "prep.pgc"
230+
#line 73 "prep.pgc"
237231

238232
{ ECPGdisconnect(__LINE__, "CURRENT");
239-
#line 80 "prep.pgc"
233+
#line 74 "prep.pgc"
240234

241235
if (sqlca.sqlcode < 0) sqlprint();}
242-
#line 80 "prep.pgc"
236+
#line 74 "prep.pgc"
243237

244238

245239
#ifdef WIN32

src/interfaces/ecpg/test/expected/thread-thread.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,37 +153,31 @@ void *test_thread(void *arg)
153153
#line 105 "thread.pgc"
154154

155155

156-
#ifdef WIN32
157-
#ifdef _MSC_VER /* requires MSVC */
158-
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
159-
#endif
160-
#endif
161-
162156
/* build up connection name, and connect to database */
163157
#ifndef _MSC_VER
164158
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
165159
#else
166160
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
167161
#endif
168162
/* exec sql whenever sqlerror sqlprint ; */
169-
#line 119 "thread.pgc"
163+
#line 113 "thread.pgc"
170164

171165
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , l_connection, 0);
172-
#line 120 "thread.pgc"
166+
#line 114 "thread.pgc"
173167

174168
if (sqlca.sqlcode < 0) sqlprint();}
175-
#line 120 "thread.pgc"
169+
#line 114 "thread.pgc"
176170

177171
if( sqlca.sqlcode != 0 )
178172
{
179173
printf("%s: ERROR: cannot connect to database!\n", l_connection);
180174
return NULL;
181175
}
182176
{ ECPGtrans(__LINE__, l_connection, "begin");
183-
#line 126 "thread.pgc"
177+
#line 120 "thread.pgc"
184178

185179
if (sqlca.sqlcode < 0) sqlprint();}
186-
#line 126 "thread.pgc"
180+
#line 120 "thread.pgc"
187181

188182

189183
/* insert into test_thread table */
@@ -194,27 +188,27 @@ if (sqlca.sqlcode < 0) sqlprint();}
194188
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
195189
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
196190
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
197-
#line 131 "thread.pgc"
191+
#line 125 "thread.pgc"
198192

199193
if (sqlca.sqlcode < 0) sqlprint();}
200-
#line 131 "thread.pgc"
194+
#line 125 "thread.pgc"
201195

202196
if( sqlca.sqlcode != 0 )
203197
printf("%s: ERROR: insert failed!\n", l_connection);
204198
}
205199

206200
/* all done */
207201
{ ECPGtrans(__LINE__, l_connection, "commit");
208-
#line 137 "thread.pgc"
202+
#line 131 "thread.pgc"
209203

210204
if (sqlca.sqlcode < 0) sqlprint();}
211-
#line 137 "thread.pgc"
205+
#line 131 "thread.pgc"
212206

213207
{ ECPGdisconnect(__LINE__, l_connection);
214-
#line 138 "thread.pgc"
208+
#line 132 "thread.pgc"
215209

216210
if (sqlca.sqlcode < 0) sqlprint();}
217-
#line 138 "thread.pgc"
211+
#line 132 "thread.pgc"
218212

219213
return NULL;
220214
}

src/interfaces/ecpg/test/expected/thread-thread_implicit.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -154,37 +154,31 @@ void *test_thread(void *arg)
154154
#line 106 "thread_implicit.pgc"
155155

156156

157-
#ifdef WIN32
158-
#ifdef _MSC_VER /* requires MSVC */
159-
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
160-
#endif
161-
#endif
162-
163157
/* build up connection name, and connect to database */
164158
#ifndef _MSC_VER
165159
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
166160
#else
167161
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
168162
#endif
169163
/* exec sql whenever sqlerror sqlprint ; */
170-
#line 120 "thread_implicit.pgc"
164+
#line 114 "thread_implicit.pgc"
171165

172166
{ ECPGconnect(__LINE__, 0, "ecpg1_regression" , NULL, NULL , l_connection, 0);
173-
#line 121 "thread_implicit.pgc"
167+
#line 115 "thread_implicit.pgc"
174168

175169
if (sqlca.sqlcode < 0) sqlprint();}
176-
#line 121 "thread_implicit.pgc"
170+
#line 115 "thread_implicit.pgc"
177171

178172
if( sqlca.sqlcode != 0 )
179173
{
180174
printf("%s: ERROR: cannot connect to database!\n", l_connection);
181175
return NULL;
182176
}
183177
{ ECPGtrans(__LINE__, NULL, "begin");
184-
#line 127 "thread_implicit.pgc"
178+
#line 121 "thread_implicit.pgc"
185179

186180
if (sqlca.sqlcode < 0) sqlprint();}
187-
#line 127 "thread_implicit.pgc"
181+
#line 121 "thread_implicit.pgc"
188182

189183

190184
/* insert into test_thread table */
@@ -195,27 +189,27 @@ if (sqlca.sqlcode < 0) sqlprint();}
195189
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
196190
ECPGt_int,&(l_i),(long)1,(long)1,sizeof(int),
197191
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
198-
#line 132 "thread_implicit.pgc"
192+
#line 126 "thread_implicit.pgc"
199193

200194
if (sqlca.sqlcode < 0) sqlprint();}
201-
#line 132 "thread_implicit.pgc"
195+
#line 126 "thread_implicit.pgc"
202196

203197
if( sqlca.sqlcode != 0 )
204198
printf("%s: ERROR: insert failed!\n", l_connection);
205199
}
206200

207201
/* all done */
208202
{ ECPGtrans(__LINE__, NULL, "commit");
209-
#line 138 "thread_implicit.pgc"
203+
#line 132 "thread_implicit.pgc"
210204

211205
if (sqlca.sqlcode < 0) sqlprint();}
212-
#line 138 "thread_implicit.pgc"
206+
#line 132 "thread_implicit.pgc"
213207

214208
{ ECPGdisconnect(__LINE__, l_connection);
215-
#line 139 "thread_implicit.pgc"
209+
#line 133 "thread_implicit.pgc"
216210

217211
if (sqlca.sqlcode < 0) sqlprint();}
218-
#line 139 "thread_implicit.pgc"
212+
#line 133 "thread_implicit.pgc"
219213

220214
return NULL;
221215
}

src/interfaces/ecpg/test/thread/alloc.pgc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ static void* fn(void* arg)
4242
char **r = NULL;
4343
EXEC SQL END DECLARE SECTION;
4444

45-
#ifdef WIN32
46-
#ifdef _MSC_VER /* requires MSVC */
47-
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
48-
#endif
49-
#endif
50-
5145
value = (long)arg;
5246
sprintf(name, "Connection: %d", value);
5347

src/interfaces/ecpg/test/thread/descriptor.pgc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ static void* fn(void* arg)
2525
{
2626
int i;
2727

28-
#ifdef WIN32
29-
#ifdef _MSC_VER /* requires MSVC */
30-
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
31-
#endif
32-
#endif
33-
3428
for (i = 1; i <= REPEATS; ++i)
3529
{
3630
EXEC SQL ALLOCATE DESCRIPTOR mydesc;

src/interfaces/ecpg/test/thread/prep.pgc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ static void* fn(void* arg)
4242
char query[256] = "INSERT INTO T VALUES ( ? )";
4343
EXEC SQL END DECLARE SECTION;
4444

45-
#ifdef WIN32
46-
#ifdef _MSC_VER /* requires MSVC */
47-
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
48-
#endif
49-
#endif
50-
5145
value = (long)arg;
5246
sprintf(name, "Connection: %d", value);
5347

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy