Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9897e35

Browse files
author
Michael Meskes
committed
Added Joachim's changes for MinGW.
Added SET DATESTYLE to one test so the output format is defined.
1 parent0f8fc35 commit9897e35

File tree

13 files changed

+230
-128
lines changed

13 files changed

+230
-128
lines changed

‎src/interfaces/ecpg/pgtypeslib/dt_common.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.35 2006/06/21 10:24:41 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.36 2006/09/26 07:56:56 meskes Exp $ */
22

33
#include"postgres_fe.h"
44

@@ -1165,6 +1165,11 @@ DetermineLocalTimeZone(struct tm * tm)
11651165
* reassemble to get a representation of local time.
11661166
*/
11671167
tmp=localtime(&mytime);
1168+
if (!tmp)
1169+
{
1170+
tm->tm_isdst=0;
1171+
return0;
1172+
}
11681173
day= (date2j(tmp->tm_year+1900,tmp->tm_mon+1,tmp->tm_mday)-
11691174
date2j(1970,1,1));
11701175
locsec=tmp->tm_sec+ (tmp->tm_min+ (day*HOURS_PER_DAY+tmp->tm_hour)*MINS_PER_HOUR)*SECS_PER_MINUTE;
@@ -1194,6 +1199,11 @@ DetermineLocalTimeZone(struct tm * tm)
11941199
mysec+=delta1;
11951200
mytime= (time_t)mysec;
11961201
tmp=localtime(&mytime);
1202+
if (!tmp)
1203+
{
1204+
tm->tm_isdst=0;
1205+
return0;
1206+
}
11971207
day= (date2j(tmp->tm_year+1900,tmp->tm_mon+1,tmp->tm_mday)-
11981208
date2j(1970,1,1));
11991209
locsec=tmp->tm_sec+ (tmp->tm_min+ (day*HOURS_PER_DAY+tmp->tm_hour)*MINS_PER_HOUR)*SECS_PER_MINUTE;
@@ -1203,6 +1213,11 @@ DetermineLocalTimeZone(struct tm * tm)
12031213
mysec+= (delta2-delta1);
12041214
mytime= (time_t)mysec;
12051215
tmp=localtime(&mytime);
1216+
if (!tmp)
1217+
{
1218+
tm->tm_isdst=0;
1219+
return0;
1220+
}
12061221
day= (date2j(tmp->tm_year+1900,tmp->tm_mon+1,tmp->tm_mday)-
12071222
date2j(1970,1,1));
12081223
locsec=tmp->tm_sec+ (tmp->tm_min+ (day*HOURS_PER_DAY+tmp->tm_hour)*MINS_PER_HOUR)*SECS_PER_MINUTE;

‎src/interfaces/ecpg/test/compat_informix/dec_test.pgc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77

88
exec sql include ../regression;
99

10+
11+
/*
12+
13+
NOTE: This file has a different expect file for regression tests on MinGW32
14+
15+
*/
16+
17+
18+
19+
1020
/*
1121
TODO:
1222
deccmp => DECUNKNOWN

‎src/interfaces/ecpg/test/expected/compat_informix-dec_test.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727
#line 8 "dec_test.pgc"
2828

2929

30+
31+
/*
32+
33+
NOTE: This file has a different expect file for regression tests on MinGW32
34+
35+
*/
36+
37+
38+
39+
3040
/*
3141
TODO:
3242
deccmp => DECUNKNOWN

‎src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323
#line 6 "num_test.pgc"
2424

2525

26+
27+
/*
28+
29+
NOTE: This file has a different expect file for regression tests on MinGW32
30+
31+
*/
32+
33+
2634
int
2735
main(void)
2836
{
@@ -32,38 +40,38 @@ main(void)
3240

3341
/* = {0, 0, 0, 0, 0, NULL, NULL} ; */
3442

35-
#line14 "num_test.pgc"
43+
#line22 "num_test.pgc"
3644
numeric*des ;
3745
/* exec sql end declare section */
38-
#line16 "num_test.pgc"
46+
#line24 "num_test.pgc"
3947

4048
doubled;
4149
longl1,l2;
4250
inti;
4351

4452
ECPGdebug(1,stderr);
4553
/* exec sql whenever sqlerror do sqlprint ( ) ; */
46-
#line22 "num_test.pgc"
54+
#line30 "num_test.pgc"
4755

4856

4957
{ECPGconnect(__LINE__,0,"regress1" ,NULL,NULL ,NULL,0);
50-
#line24 "num_test.pgc"
58+
#line32 "num_test.pgc"
5159

5260
if (sqlca.sqlcode<0)sqlprint ( );}
53-
#line24 "num_test.pgc"
61+
#line32 "num_test.pgc"
5462

5563

5664
{ECPGsetcommit(__LINE__,"off",NULL);
57-
#line26 "num_test.pgc"
65+
#line34 "num_test.pgc"
5866

5967
if (sqlca.sqlcode<0)sqlprint ( );}
60-
#line26 "num_test.pgc"
68+
#line34 "num_test.pgc"
6169

6270
{ECPGdo(__LINE__,0,1,NULL,"create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) ",ECPGt_EOIT,ECPGt_EORT);
63-
#line27 "num_test.pgc"
71+
#line35 "num_test.pgc"
6472

6573
if (sqlca.sqlcode<0)sqlprint ( );}
66-
#line27 "num_test.pgc"
74+
#line35 "num_test.pgc"
6775

6876

6977
value1=PGTYPESnumeric_new();
@@ -92,10 +100,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
92100
{ECPGdo(__LINE__,0,1,NULL,"insert into test ( text , num ) values( 'test' , ? ) ",
93101
ECPGt_numeric,&(des),(long)1,(long)0,sizeof(numeric),
94102
ECPGt_NO_INDICATOR,NULL ,0L,0L,0L,ECPGt_EOIT,ECPGt_EORT);
95-
#line52 "num_test.pgc"
103+
#line60 "num_test.pgc"
96104

97105
if (sqlca.sqlcode<0)sqlprint ( );}
98-
#line52 "num_test.pgc"
106+
#line60 "num_test.pgc"
99107

100108

101109
value2=PGTYPESnumeric_from_asc("2369.7",NULL);
@@ -105,10 +113,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
105113
{ECPGdo(__LINE__,0,1,NULL,"select num from test where text = 'test' ",ECPGt_EOIT,
106114
ECPGt_numeric,&(des),(long)1,(long)0,sizeof(numeric),
107115
ECPGt_NO_INDICATOR,NULL ,0L,0L,0L,ECPGt_EORT);
108-
#line58 "num_test.pgc"
116+
#line66 "num_test.pgc"
109117

110118
if (sqlca.sqlcode<0)sqlprint ( );}
111-
#line58 "num_test.pgc"
119+
#line66 "num_test.pgc"
112120

113121

114122
PGTYPESnumeric_mul(res,des,res);
@@ -134,16 +142,16 @@ if (sqlca.sqlcode < 0) sqlprint ( );}
134142
PGTYPESnumeric_free(res);
135143

136144
{ECPGtrans(__LINE__,NULL,"rollback");
137-
#line82 "num_test.pgc"
145+
#line90 "num_test.pgc"
138146

139147
if (sqlca.sqlcode<0)sqlprint ( );}
140-
#line82 "num_test.pgc"
148+
#line90 "num_test.pgc"
141149

142150
{ECPGdisconnect(__LINE__,"CURRENT");
143-
#line83 "num_test.pgc"
151+
#line91 "num_test.pgc"
144152

145153
if (sqlca.sqlcode<0)sqlprint ( );}
146-
#line83 "num_test.pgc"
154+
#line91 "num_test.pgc"
147155

148156

149157
return (0);

‎src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
[NO_PID]: sqlca: code: 0, state: 00000
33
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
44
[NO_PID]: sqlca: code: 0, state: 00000
5-
[NO_PID]: ECPGsetcommit line26 action = off connection = regress1
5+
[NO_PID]: ECPGsetcommit line34 action = off connection = regress1
66
[NO_PID]: sqlca: code: 0, state: 00000
7-
[NO_PID]: ECPGexecute line27: QUERY: create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) on connection regress1
7+
[NO_PID]: ECPGexecute line35: QUERY: create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) on connection regress1
88
[NO_PID]: sqlca: code: 0, state: 00000
9-
[NO_PID]: ECPGexecute line27 Ok: CREATE TABLE
9+
[NO_PID]: ECPGexecute line35 Ok: CREATE TABLE
1010
[NO_PID]: sqlca: code: 0, state: 00000
11-
[NO_PID]: ECPGexecute line52: QUERY: insert into test ( text , num ) values( 'test' , 2369.7 ) on connection regress1
11+
[NO_PID]: ECPGexecute line60: QUERY: insert into test ( text , num ) values( 'test' , 2369.7 ) on connection regress1
1212
[NO_PID]: sqlca: code: 0, state: 00000
13-
[NO_PID]: ECPGexecute line52 Ok: INSERT 0 1
13+
[NO_PID]: ECPGexecute line60 Ok: INSERT 0 1
1414
[NO_PID]: sqlca: code: 0, state: 00000
15-
[NO_PID]: ECPGexecute line58: QUERY: select num from test where text = 'test' on connection regress1
15+
[NO_PID]: ECPGexecute line66: QUERY: select num from test where text = 'test' on connection regress1
1616
[NO_PID]: sqlca: code: 0, state: 00000
17-
[NO_PID]: ECPGexecute line58: Correctly got 1 tuples with 1 fields
17+
[NO_PID]: ECPGexecute line66: Correctly got 1 tuples with 1 fields
1818
[NO_PID]: sqlca: code: 0, state: 00000
19-
[NO_PID]: ECPGget_data line58: RESULT: 2369.7000000 offset: -1 array: Yes
19+
[NO_PID]: ECPGget_data line66: RESULT: 2369.7000000 offset: -1 array: Yes
2020
[NO_PID]: sqlca: code: 0, state: 00000
21-
[NO_PID]: ECPGtrans line82 action = rollback connection = regress1
21+
[NO_PID]: ECPGtrans line90 action = rollback connection = regress1
2222
[NO_PID]: sqlca: code: 0, state: 00000
2323
[NO_PID]: ecpg_finish: Connection regress1 closed.
2424
[NO_PID]: sqlca: code: 0, state: 00000

‎src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
#line 7 "num_test2.pgc"
2525

2626

27+
28+
/*
29+
30+
NOTE: This file has a different expect file for regression tests on MinGW32
31+
32+
*/
33+
34+
2735
char*nums[]= {"2E394","-2",".794","3.44","592.49E21","-32.84e4",
2836
"2E-394",".1E-2","+.0","-592.49E-07","+32.84e-4",
2937
".500001","-.5000001",

‎src/interfaces/ecpg/test/expected/preproc-variable.c

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -126,64 +126,72 @@ if (sqlca.sqlcode < 0) sqlprint();}
126126
#line 43 "variable.pgc"
127127

128128

129-
strcpy(msg,"create");
130-
{ECPGdo(__LINE__,0,1,NULL,"create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer )",ECPGt_EOIT,ECPGt_EORT);
129+
strcpy(msg,"set");
130+
{ECPGdo(__LINE__,0,1,NULL,"set datestyle to iso",ECPGt_EOIT,ECPGt_EORT);
131131
#line 46 "variable.pgc"
132132

133133
if (sqlca.sqlcode<0)sqlprint();}
134134
#line 46 "variable.pgc"
135135

136136

137-
strcpy(msg,"insert");
138-
{ECPGdo(__LINE__,0,1,NULL,"insert intofamily ( name , married , children ) values ( 'Mum' , '19870714' , 3 ) ",ECPGt_EOIT,ECPGt_EORT);
137+
strcpy(msg,"create");
138+
{ECPGdo(__LINE__,0,1,NULL,"create tablefamily ( namechar ( 8 ) , born integer , age smallint , married date , children integer ) ",ECPGt_EOIT,ECPGt_EORT);
139139
#line 49 "variable.pgc"
140140

141141
if (sqlca.sqlcode<0)sqlprint();}
142142
#line 49 "variable.pgc"
143143

144+
145+
strcpy(msg,"insert");
146+
{ECPGdo(__LINE__,0,1,NULL,"insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ) ",ECPGt_EOIT,ECPGt_EORT);
147+
#line 52 "variable.pgc"
148+
149+
if (sqlca.sqlcode<0)sqlprint();}
150+
#line 52 "variable.pgc"
151+
144152
{ECPGdo(__LINE__,0,1,NULL,"insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ) ",ECPGt_EOIT,ECPGt_EORT);
145-
#line50 "variable.pgc"
153+
#line53 "variable.pgc"
146154

147155
if (sqlca.sqlcode<0)sqlprint();}
148-
#line50 "variable.pgc"
156+
#line53 "variable.pgc"
149157

150158
{ECPGdo(__LINE__,0,1,NULL,"insert into family ( name , age ) values ( 'Child 1' , 16 ) ",ECPGt_EOIT,ECPGt_EORT);
151-
#line51 "variable.pgc"
159+
#line54 "variable.pgc"
152160

153161
if (sqlca.sqlcode<0)sqlprint();}
154-
#line51 "variable.pgc"
162+
#line54 "variable.pgc"
155163

156164
{ECPGdo(__LINE__,0,1,NULL,"insert into family ( name , age ) values ( 'Child 2' , 14 ) ",ECPGt_EOIT,ECPGt_EORT);
157-
#line52 "variable.pgc"
165+
#line55 "variable.pgc"
158166

159167
if (sqlca.sqlcode<0)sqlprint();}
160-
#line52 "variable.pgc"
168+
#line55 "variable.pgc"
161169

162170
{ECPGdo(__LINE__,0,1,NULL,"insert into family ( name , age ) values ( 'Child 3' , 9 ) ",ECPGt_EOIT,ECPGt_EORT);
163-
#line53 "variable.pgc"
171+
#line56 "variable.pgc"
164172

165173
if (sqlca.sqlcode<0)sqlprint();}
166-
#line53 "variable.pgc"
174+
#line56 "variable.pgc"
167175

168176

169177
strcpy(msg,"commit");
170178
{ECPGtrans(__LINE__,NULL,"commit");
171-
#line56 "variable.pgc"
179+
#line59 "variable.pgc"
172180

173181
if (sqlca.sqlcode<0)sqlprint();}
174-
#line56 "variable.pgc"
182+
#line59 "variable.pgc"
175183

176184

177185
strcpy(msg,"open");
178186
{ECPGdo(__LINE__,0,1,NULL,"declare cur cursor for select name , born , age , married , children from family ",ECPGt_EOIT,ECPGt_EORT);
179-
#line59 "variable.pgc"
187+
#line62 "variable.pgc"
180188

181189
if (sqlca.sqlcode<0)sqlprint();}
182-
#line59 "variable.pgc"
190+
#line62 "variable.pgc"
183191

184192

185193
/* exec sql whenever not found break ; */
186-
#line61 "variable.pgc"
194+
#line64 "variable.pgc"
187195

188196

189197
p=&personal;
@@ -202,13 +210,13 @@ if (sqlca.sqlcode < 0) sqlprint();}
202210
ECPGt_long,&(ind_married),(long)1,(long)1,sizeof(long),
203211
ECPGt_int,&(children.integer),(long)1,(long)1,sizeof(int),
204212
ECPGt_short,&(ind_children.smallint),(long)1,(long)1,sizeof(short),ECPGt_EORT);
205-
#line68 "variable.pgc"
213+
#line71 "variable.pgc"
206214

207215
if (sqlca.sqlcode==ECPG_NOT_FOUND)break;
208-
#line68 "variable.pgc"
216+
#line71 "variable.pgc"
209217

210218
if (sqlca.sqlcode<0)sqlprint();}
211-
#line68 "variable.pgc"
219+
#line71 "variable.pgc"
212220

213221
printf("%8.8s",personal.name.arr);
214222
if (i->ind_birth.born >=0)
@@ -227,34 +235,34 @@ if (sqlca.sqlcode < 0) sqlprint();}
227235

228236
strcpy(msg,"close");
229237
{ECPGdo(__LINE__,0,1,NULL,"close cur",ECPGt_EOIT,ECPGt_EORT);
230-
#line85 "variable.pgc"
238+
#line88 "variable.pgc"
231239

232240
if (sqlca.sqlcode<0)sqlprint();}
233-
#line85 "variable.pgc"
241+
#line88 "variable.pgc"
234242

235243

236244
strcpy(msg,"drop");
237245
{ECPGdo(__LINE__,0,1,NULL,"drop table family ",ECPGt_EOIT,ECPGt_EORT);
238-
#line88 "variable.pgc"
246+
#line91 "variable.pgc"
239247

240248
if (sqlca.sqlcode<0)sqlprint();}
241-
#line88 "variable.pgc"
249+
#line91 "variable.pgc"
242250

243251

244252
strcpy(msg,"commit");
245253
{ECPGtrans(__LINE__,NULL,"commit");
246-
#line91 "variable.pgc"
254+
#line94 "variable.pgc"
247255

248256
if (sqlca.sqlcode<0)sqlprint();}
249-
#line91 "variable.pgc"
257+
#line94 "variable.pgc"
250258

251259

252260
strcpy(msg,"disconnect");
253261
{ECPGdisconnect(__LINE__,"CURRENT");
254-
#line94 "variable.pgc"
262+
#line97 "variable.pgc"
255263

256264
if (sqlca.sqlcode<0)sqlprint();}
257-
#line94 "variable.pgc"
265+
#line97 "variable.pgc"
258266

259267

260268
return (0);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp