From 9897e35c5666e5384ca0dc49456b55a014b15d96 Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Tue, 26 Sep 2006 07:56:57 +0000 Subject: [PATCH] Added Joachim's changes for MinGW. Added SET DATESTYLE to one test so the output format is defined. --- src/interfaces/ecpg/pgtypeslib/dt_common.c | 17 ++- .../ecpg/test/compat_informix/dec_test.pgc | 10 ++ .../test/expected/compat_informix-dec_test.c | 10 ++ .../ecpg/test/expected/pgtypeslib-num_test.c | 42 +++--- .../test/expected/pgtypeslib-num_test.stderr | 18 +-- .../ecpg/test/expected/pgtypeslib-num_test2.c | 8 ++ .../ecpg/test/expected/preproc-variable.c | 64 +++++---- .../test/expected/preproc-variable.stderr | 130 +++++++++--------- .../test/expected/preproc-variable.stdout | 4 +- src/interfaces/ecpg/test/pg_regress.sh | 36 +++-- .../ecpg/test/pgtypeslib/num_test.pgc | 8 ++ .../ecpg/test/pgtypeslib/num_test2.pgc | 8 ++ src/interfaces/ecpg/test/preproc/variable.pgc | 3 + 13 files changed, 230 insertions(+), 128 deletions(-) diff --git a/src/interfaces/ecpg/pgtypeslib/dt_common.c b/src/interfaces/ecpg/pgtypeslib/dt_common.c index 6ec9a12512..d6ccf3310d 100644 --- a/src/interfaces/ecpg/pgtypeslib/dt_common.c +++ b/src/interfaces/ecpg/pgtypeslib/dt_common.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.35 2006/06/21 10:24:41 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.36 2006/09/26 07:56:56 meskes Exp $ */ #include "postgres_fe.h" @@ -1165,6 +1165,11 @@ DetermineLocalTimeZone(struct tm * tm) * reassemble to get a representation of local time. */ tmp = localtime(&mytime); + if (!tmp) + { + tm->tm_isdst = 0; + return 0; + } day = (date2j(tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday) - date2j(1970, 1, 1)); 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) mysec += delta1; mytime = (time_t) mysec; tmp = localtime(&mytime); + if (!tmp) + { + tm->tm_isdst = 0; + return 0; + } day = (date2j(tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday) - date2j(1970, 1, 1)); 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) mysec += (delta2 - delta1); mytime = (time_t) mysec; tmp = localtime(&mytime); + if (!tmp) + { + tm->tm_isdst = 0; + return 0; + } day = (date2j(tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday) - date2j(1970, 1, 1)); locsec = tmp->tm_sec + (tmp->tm_min + (day * HOURS_PER_DAY + tmp->tm_hour) * MINS_PER_HOUR) * SECS_PER_MINUTE; diff --git a/src/interfaces/ecpg/test/compat_informix/dec_test.pgc b/src/interfaces/ecpg/test/compat_informix/dec_test.pgc index 37b9a40b3a..31f365d2e3 100644 --- a/src/interfaces/ecpg/test/compat_informix/dec_test.pgc +++ b/src/interfaces/ecpg/test/compat_informix/dec_test.pgc @@ -7,6 +7,16 @@ exec sql include ../regression; + +/* + +NOTE: This file has a different expect file for regression tests on MinGW32 + +*/ + + + + /* TODO: deccmp => DECUNKNOWN diff --git a/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c b/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c index 76e321af15..a130aa17c9 100644 --- a/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c +++ b/src/interfaces/ecpg/test/expected/compat_informix-dec_test.c @@ -27,6 +27,16 @@ #line 8 "dec_test.pgc" + +/* + +NOTE: This file has a different expect file for regression tests on MinGW32 + +*/ + + + + /* TODO: deccmp => DECUNKNOWN diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c index e997a2ce4e..e45abe6368 100644 --- a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c +++ b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c @@ -23,6 +23,14 @@ #line 6 "num_test.pgc" + +/* + +NOTE: This file has a different expect file for regression tests on MinGW32 + +*/ + + int main(void) { @@ -32,10 +40,10 @@ main(void) /* = {0, 0, 0, 0, 0, NULL, NULL} ; */ -#line 14 "num_test.pgc" +#line 22 "num_test.pgc" numeric * des ; /* exec sql end declare section */ -#line 16 "num_test.pgc" +#line 24 "num_test.pgc" double d; long l1, l2; @@ -43,27 +51,27 @@ main(void) ECPGdebug(1, stderr); /* exec sql whenever sqlerror do sqlprint ( ) ; */ -#line 22 "num_test.pgc" +#line 30 "num_test.pgc" { ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); -#line 24 "num_test.pgc" +#line 32 "num_test.pgc" if (sqlca.sqlcode < 0) sqlprint ( );} -#line 24 "num_test.pgc" +#line 32 "num_test.pgc" { ECPGsetcommit(__LINE__, "off", NULL); -#line 26 "num_test.pgc" +#line 34 "num_test.pgc" if (sqlca.sqlcode < 0) sqlprint ( );} -#line 26 "num_test.pgc" +#line 34 "num_test.pgc" { ECPGdo(__LINE__, 0, 1, NULL, "create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) ", ECPGt_EOIT, ECPGt_EORT); -#line 27 "num_test.pgc" +#line 35 "num_test.pgc" if (sqlca.sqlcode < 0) sqlprint ( );} -#line 27 "num_test.pgc" +#line 35 "num_test.pgc" value1 = PGTYPESnumeric_new(); @@ -92,10 +100,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );} { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( text , num ) values( 'test' , ? ) ", ECPGt_numeric,&(des),(long)1,(long)0,sizeof(numeric), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); -#line 52 "num_test.pgc" +#line 60 "num_test.pgc" if (sqlca.sqlcode < 0) sqlprint ( );} -#line 52 "num_test.pgc" +#line 60 "num_test.pgc" value2 = PGTYPESnumeric_from_asc("2369.7", NULL); @@ -105,10 +113,10 @@ if (sqlca.sqlcode < 0) sqlprint ( );} { ECPGdo(__LINE__, 0, 1, NULL, "select num from test where text = 'test' ", ECPGt_EOIT, ECPGt_numeric,&(des),(long)1,(long)0,sizeof(numeric), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); -#line 58 "num_test.pgc" +#line 66 "num_test.pgc" if (sqlca.sqlcode < 0) sqlprint ( );} -#line 58 "num_test.pgc" +#line 66 "num_test.pgc" PGTYPESnumeric_mul(res, des, res); @@ -134,16 +142,16 @@ if (sqlca.sqlcode < 0) sqlprint ( );} PGTYPESnumeric_free(res); { ECPGtrans(__LINE__, NULL, "rollback"); -#line 82 "num_test.pgc" +#line 90 "num_test.pgc" if (sqlca.sqlcode < 0) sqlprint ( );} -#line 82 "num_test.pgc" +#line 90 "num_test.pgc" { ECPGdisconnect(__LINE__, "CURRENT"); -#line 83 "num_test.pgc" +#line 91 "num_test.pgc" if (sqlca.sqlcode < 0) sqlprint ( );} -#line 83 "num_test.pgc" +#line 91 "num_test.pgc" return (0); diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr index 1bab3a304a..63103d8c00 100644 --- a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr +++ b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr @@ -2,23 +2,23 @@ [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGconnect: opening database regress1 on port [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGsetcommit line 26 action = off connection = regress1 +[NO_PID]: ECPGsetcommit line 34 action = off connection = regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 27: QUERY: create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) on connection regress1 +[NO_PID]: ECPGexecute line 35: QUERY: create table test ( text char ( 5 ) , num numeric ( 14 , 7 ) ) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 27 Ok: CREATE TABLE +[NO_PID]: ECPGexecute line 35 Ok: CREATE TABLE [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 52: QUERY: insert into test ( text , num ) values( 'test' , 2369.7 ) on connection regress1 +[NO_PID]: ECPGexecute line 60: QUERY: insert into test ( text , num ) values ( 'test' , 2369.7 ) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 52 Ok: INSERT 0 1 +[NO_PID]: ECPGexecute line 60 Ok: INSERT 0 1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 58: QUERY: select num from test where text = 'test' on connection regress1 +[NO_PID]: ECPGexecute line 66: QUERY: select num from test where text = 'test' on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 58: Correctly got 1 tuples with 1 fields +[NO_PID]: ECPGexecute line 66: Correctly got 1 tuples with 1 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 58: RESULT: 2369.7000000 offset: -1 array: Yes +[NO_PID]: ECPGget_data line 66: RESULT: 2369.7000000 offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGtrans line 82 action = rollback connection = regress1 +[NO_PID]: ECPGtrans line 90 action = rollback connection = regress1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_finish: Connection regress1 closed. [NO_PID]: sqlca: code: 0, state: 00000 diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c index df7a39898a..9db09e7188 100644 --- a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c +++ b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c @@ -24,6 +24,14 @@ #line 7 "num_test2.pgc" + +/* + +NOTE: This file has a different expect file for regression tests on MinGW32 + +*/ + + char* nums[] = { "2E394", "-2", ".794", "3.44", "592.49E21", "-32.84e4", "2E-394", ".1E-2", "+.0", "-592.49E-07", "+32.84e-4", ".500001", "-.5000001", diff --git a/src/interfaces/ecpg/test/expected/preproc-variable.c b/src/interfaces/ecpg/test/expected/preproc-variable.c index 7f6b4dcc8e..3781992747 100644 --- a/src/interfaces/ecpg/test/expected/preproc-variable.c +++ b/src/interfaces/ecpg/test/expected/preproc-variable.c @@ -126,64 +126,72 @@ if (sqlca.sqlcode < 0) sqlprint();} #line 43 "variable.pgc" - strcpy(msg, "create"); - { ECPGdo(__LINE__, 0, 1, NULL, "create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ) ", ECPGt_EOIT, ECPGt_EORT); + strcpy(msg, "set"); + { ECPGdo(__LINE__, 0, 1, NULL, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT); #line 46 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} #line 46 "variable.pgc" - strcpy(msg, "insert"); - { ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ) ", ECPGt_EOIT, ECPGt_EORT); + strcpy(msg, "create"); + { ECPGdo(__LINE__, 0, 1, NULL, "create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ) ", ECPGt_EOIT, ECPGt_EORT); #line 49 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} #line 49 "variable.pgc" + + strcpy(msg, "insert"); + { ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ) ", ECPGt_EOIT, ECPGt_EORT); +#line 52 "variable.pgc" + +if (sqlca.sqlcode < 0) sqlprint();} +#line 52 "variable.pgc" + { ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ) ", ECPGt_EOIT, ECPGt_EORT); -#line 50 "variable.pgc" +#line 53 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} -#line 50 "variable.pgc" +#line 53 "variable.pgc" { ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , age ) values ( 'Child 1' , 16 ) ", ECPGt_EOIT, ECPGt_EORT); -#line 51 "variable.pgc" +#line 54 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} -#line 51 "variable.pgc" +#line 54 "variable.pgc" { ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , age ) values ( 'Child 2' , 14 ) ", ECPGt_EOIT, ECPGt_EORT); -#line 52 "variable.pgc" +#line 55 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} -#line 52 "variable.pgc" +#line 55 "variable.pgc" { ECPGdo(__LINE__, 0, 1, NULL, "insert into family ( name , age ) values ( 'Child 3' , 9 ) ", ECPGt_EOIT, ECPGt_EORT); -#line 53 "variable.pgc" +#line 56 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} -#line 53 "variable.pgc" +#line 56 "variable.pgc" strcpy(msg, "commit"); { ECPGtrans(__LINE__, NULL, "commit"); -#line 56 "variable.pgc" +#line 59 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} -#line 56 "variable.pgc" +#line 59 "variable.pgc" strcpy(msg, "open"); { ECPGdo(__LINE__, 0, 1, NULL, "declare cur cursor for select name , born , age , married , children from family ", ECPGt_EOIT, ECPGt_EORT); -#line 59 "variable.pgc" +#line 62 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} -#line 59 "variable.pgc" +#line 62 "variable.pgc" /* exec sql whenever not found break ; */ -#line 61 "variable.pgc" +#line 64 "variable.pgc" p=&personal; @@ -202,13 +210,13 @@ if (sqlca.sqlcode < 0) sqlprint();} ECPGt_long,&(ind_married),(long)1,(long)1,sizeof(long), ECPGt_int,&(children.integer),(long)1,(long)1,sizeof(int), ECPGt_short,&(ind_children.smallint),(long)1,(long)1,sizeof(short), ECPGt_EORT); -#line 68 "variable.pgc" +#line 71 "variable.pgc" if (sqlca.sqlcode == ECPG_NOT_FOUND) break; -#line 68 "variable.pgc" +#line 71 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} -#line 68 "variable.pgc" +#line 71 "variable.pgc" printf("%8.8s", personal.name.arr); if (i->ind_birth.born >= 0) @@ -227,34 +235,34 @@ if (sqlca.sqlcode < 0) sqlprint();} strcpy(msg, "close"); { ECPGdo(__LINE__, 0, 1, NULL, "close cur", ECPGt_EOIT, ECPGt_EORT); -#line 85 "variable.pgc" +#line 88 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} -#line 85 "variable.pgc" +#line 88 "variable.pgc" strcpy(msg, "drop"); { ECPGdo(__LINE__, 0, 1, NULL, "drop table family ", ECPGt_EOIT, ECPGt_EORT); -#line 88 "variable.pgc" +#line 91 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} -#line 88 "variable.pgc" +#line 91 "variable.pgc" strcpy(msg, "commit"); { ECPGtrans(__LINE__, NULL, "commit"); -#line 91 "variable.pgc" +#line 94 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} -#line 91 "variable.pgc" +#line 94 "variable.pgc" strcpy(msg, "disconnect"); { ECPGdisconnect(__LINE__, "CURRENT"); -#line 94 "variable.pgc" +#line 97 "variable.pgc" if (sqlca.sqlcode < 0) sqlprint();} -#line 94 "variable.pgc" +#line 97 "variable.pgc" return (0); diff --git a/src/interfaces/ecpg/test/expected/preproc-variable.stderr b/src/interfaces/ecpg/test/expected/preproc-variable.stderr index ad15dad529..3fc175378e 100644 --- a/src/interfaces/ecpg/test/expected/preproc-variable.stderr +++ b/src/interfaces/ecpg/test/expected/preproc-variable.stderr @@ -2,131 +2,135 @@ [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGconnect: opening database regress1 on port [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 46: QUERY: create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ) on connection regress1 +[NO_PID]: ECPGexecute line 46: QUERY: set datestyle to iso on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 46 Ok: CREATE TABLE +[NO_PID]: ECPGexecute line 46 Ok: SET [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 49: QUERY: insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ) on connection regress1 +[NO_PID]: ECPGexecute line 49: QUERY: create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 49 Ok: INSERT 0 1 +[NO_PID]: ECPGexecute line 49 Ok: CREATE TABLE [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 50: QUERY: insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ) on connection regress1 +[NO_PID]: ECPGexecute line 52: QUERY: insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 50 Ok: INSERT 0 1 +[NO_PID]: ECPGexecute line 52 Ok: INSERT 0 1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 51: QUERY: insert into family ( name , age ) values ( 'Child 1' , 16 ) on connection regress1 +[NO_PID]: ECPGexecute line 53: QUERY: insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 51 Ok: INSERT 0 1 +[NO_PID]: ECPGexecute line 53 Ok: INSERT 0 1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 52: QUERY: insert into family ( name , age ) values ( 'Child 2' , 14 ) on connection regress1 +[NO_PID]: ECPGexecute line 54: QUERY: insert into family ( name , age ) values ( 'Child 1' , 16 ) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 52 Ok: INSERT 0 1 +[NO_PID]: ECPGexecute line 54 Ok: INSERT 0 1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 53: QUERY: insert into family ( name , age ) values ( 'Child 3' , 9 ) on connection regress1 +[NO_PID]: ECPGexecute line 55: QUERY: insert into family ( name , age ) values ( 'Child 2' , 14 ) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 53 Ok: INSERT 0 1 +[NO_PID]: ECPGexecute line 55 Ok: INSERT 0 1 +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ECPGexecute line 56: QUERY: insert into family ( name , age ) values ( 'Child 3' , 9 ) on connection regress1 +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ECPGexecute line 56 Ok: INSERT 0 1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGtrans line 56 action = commit connection = regress1 +[NO_PID]: ECPGtrans line 59 action = commit connection = regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 59: QUERY: declare cur cursor for select name , born , age , married , children from family on connection regress1 +[NO_PID]: ECPGexecute line 62: QUERY: declare cur cursor for select name , born , age , married , children from family on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 59 Ok: DECLARE CURSOR +[NO_PID]: ECPGexecute line 62 Ok: DECLARE CURSOR [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 68: QUERY: fetch cur on connection regress1 +[NO_PID]: ECPGexecute line 71: QUERY: fetch cur on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 68: Correctly got 1 tuples with 5 fields +[NO_PID]: ECPGexecute line 71: Correctly got 1 tuples with 5 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: Mum offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: Mum offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGstore_result: line 68: allocating memory for 1 tuples +[NO_PID]: ECPGstore_result: line 71: allocating memory for 1 tuples [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: 07-14-1987 offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: 1987-07-14 offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: 3 offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: 3 offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 68: QUERY: fetch cur on connection regress1 +[NO_PID]: ECPGexecute line 71: QUERY: fetch cur on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 68: Correctly got 1 tuples with 5 fields +[NO_PID]: ECPGexecute line 71: Correctly got 1 tuples with 5 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: Dad offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: Dad offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: 19610721 offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: 19610721 offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGstore_result: line 68: allocating memory for 1 tuples +[NO_PID]: ECPGstore_result: line 71: allocating memory for 1 tuples [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: 07-14-1987 offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: 1987-07-14 offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: 3 offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: 3 offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 68: QUERY: fetch cur on connection regress1 +[NO_PID]: ECPGexecute line 71: QUERY: fetch cur on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 68: Correctly got 1 tuples with 5 fields +[NO_PID]: ECPGexecute line 71: Correctly got 1 tuples with 5 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: Child 1 offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: Child 1 offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: 16 offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: 16 offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGstore_result: line 68: allocating memory for 1 tuples +[NO_PID]: ECPGstore_result: line 71: allocating memory for 1 tuples [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 68: QUERY: fetch cur on connection regress1 +[NO_PID]: ECPGexecute line 71: QUERY: fetch cur on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 68: Correctly got 1 tuples with 5 fields +[NO_PID]: ECPGexecute line 71: Correctly got 1 tuples with 5 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: Child 2 offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: Child 2 offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: 14 offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: 14 offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGstore_result: line 68: allocating memory for 1 tuples +[NO_PID]: ECPGstore_result: line 71: allocating memory for 1 tuples [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 68: QUERY: fetch cur on connection regress1 +[NO_PID]: ECPGexecute line 71: QUERY: fetch cur on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 68: Correctly got 1 tuples with 5 fields +[NO_PID]: ECPGexecute line 71: Correctly got 1 tuples with 5 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: Child 3 offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: Child 3 offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: 9 offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: 9 offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGstore_result: line 68: allocating memory for 1 tuples +[NO_PID]: ECPGstore_result: line 71: allocating memory for 1 tuples [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGget_data line 68: RESULT: offset: -1 array: Yes +[NO_PID]: ECPGget_data line 71: RESULT: offset: -1 array: Yes [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 68: QUERY: fetch cur on connection regress1 +[NO_PID]: ECPGexecute line 71: QUERY: fetch cur on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 68: Correctly got 0 tuples with 5 fields +[NO_PID]: ECPGexecute line 71: Correctly got 0 tuples with 5 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: raising sqlcode 100 in line 68, 'No data found in line 68.'. +[NO_PID]: raising sqlcode 100 in line 71, 'No data found in line 71.'. [NO_PID]: sqlca: code: 100, state: 02000 -[NO_PID]: ECPGexecute line 85: QUERY: close cur on connection regress1 +[NO_PID]: ECPGexecute line 88: QUERY: close cur on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 85 Ok: CLOSE CURSOR +[NO_PID]: ECPGexecute line 88 Ok: CLOSE CURSOR [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 88: QUERY: drop table family on connection regress1 +[NO_PID]: ECPGexecute line 91: QUERY: drop table family on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGexecute line 88 Ok: DROP TABLE +[NO_PID]: ECPGexecute line 91 Ok: DROP TABLE [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGtrans line 91 action = commit connection = regress1 +[NO_PID]: ECPGtrans line 94 action = commit connection = regress1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_finish: Connection regress1 closed. [NO_PID]: sqlca: code: 0, state: 00000 diff --git a/src/interfaces/ecpg/test/expected/preproc-variable.stdout b/src/interfaces/ecpg/test/expected/preproc-variable.stdout index 55b88ffd65..f4ee9c3b15 100644 --- a/src/interfaces/ecpg/test/expected/preproc-variable.stdout +++ b/src/interfaces/ecpg/test/expected/preproc-variable.stdout @@ -1,5 +1,5 @@ -Mum , married 07-14-1987, children = 3 -Dad , born 19610721, married 07-14-1987, children = 3 +Mum , married 1987-07-14, children = 3 +Dad , born 19610721, married 1987-07-14, children = 3 Child 1 , age = 16 Child 2 , age = 14 Child 3 , age = 9 diff --git a/src/interfaces/ecpg/test/pg_regress.sh b/src/interfaces/ecpg/test/pg_regress.sh index 9f27d374d4..9670ca9b52 100644 --- a/src/interfaces/ecpg/test/pg_regress.sh +++ b/src/interfaces/ecpg/test/pg_regress.sh @@ -1,5 +1,5 @@ #! /bin/sh -# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.14 2006/09/19 15:36:08 tgl Exp $ +# $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress.sh,v 1.15 2006/09/26 07:56:56 meskes Exp $ me=`basename $0` @@ -735,6 +735,13 @@ for i in \ runprg=`echo $i | sed -e 's,\.pgc$,,'` outprg=`echo $runprg | sed -e's/\//-/'` + + case $host_platform in + *-*-mingw32*) + PLATFORM_TAG="-MinGW32" + ;; + esac + outfile_stderr="$outputdir/$outprg.stderr" outfile_stdout="$outputdir/$outprg.stdout" outfile_source="$outputdir/$outprg.c" @@ -753,7 +760,9 @@ for i in \ echo >> $f echo "THE PORT NUMBER MIGHT HAVE BEEN CHANGED BY THE REGRESSION SCRIPT" >> $f echo >> $f - cat $f.tmp | sed -e s,$PGPORT,55432,g >> $f + # MinGW could return such a line: + # "could not connect to server: Connection refused (0x0000274D/10061)" + cat $f.tmp | sed -e s,$PGPORT,55432,g | sed -e "s,could not connect to server: Connection refused (0x.*/.*),could not connect to server: Connection refused,g" >> $f rm $f.tmp done fi @@ -762,23 +771,34 @@ for i in \ cat "$outfile_source.tmp" | sed -e 's,^\(#line [0-9]*\) ".*/\([^/]*\)",\1 "\2",' > "$outfile_source" rm "$outfile_source.tmp" + expected_stderr="expected/$outprg$PLATFORM_TAG.stderr" + if [ ! -f "$expected_stderr" ]; then + expected_stderr="expected/$outprg.stderr" + fi + expected_stdout="expected/$outprg$PLATFORM_TAG.stdout" + if [ ! -f "$expected_stdout" ]; then + expected_stdout="expected/$outprg.stdout" + fi + # the source should be identical on all platforms + expected_source="expected/$outprg.c" + DIFFER="" - diff $DIFFFLAGS expected/$outprg.stderr "$outfile_stderr" > /dev/null 2>&1 + diff $DIFFFLAGS "$expected_stderr" "$outfile_stderr" > /dev/null 2>&1 if [ $? != 0 ]; then DIFFER="$DIFFER, log" - diff $DIFFPRETTYFLAGS expected/$outprg.stderr "$outfile_stderr" >> regression.diffs 2>&1 + diff $DIFFPRETTYFLAGS "$expected_stderr" "$outfile_stderr" >> regression.diffs 2>&1 fi - diff $DIFFFLAGS expected/$outprg.stdout "$outfile_stdout" > /dev/null 2>&1 + diff $DIFFFLAGS "$expected_stdout" "$outfile_stdout" > /dev/null 2>&1 if [ $? != 0 ]; then DIFFER="$DIFFER, output" - diff $DIFFPRETTYFLAGS expected/$outprg.stdout "$outfile_stdout" >> regression.diffs 2>&1 + diff $DIFFPRETTYFLAGS "$expected_stdout" "$outfile_stdout" >> regression.diffs 2>&1 fi - diff $DIFFFLAGS expected/$outprg.c "$outputdir"/$outprg.c > /dev/null 2>&1 + diff $DIFFFLAGS "$expected_source" "$outputdir"/$outprg.c > /dev/null 2>&1 if [ $? != 0 ]; then DIFFER="$DIFFER, source" - diff $DIFFPRETTYFLAGS expected/$outprg.c "$outputdir"/$outprg.c >> regression.diffs 2>&1 + diff $DIFFPRETTYFLAGS "$expected_source" "$outputdir"/$outprg.c >> regression.diffs 2>&1 fi DIFFER=`echo $DIFFER | sed -e 's/^, //'` diff --git a/src/interfaces/ecpg/test/pgtypeslib/num_test.pgc b/src/interfaces/ecpg/test/pgtypeslib/num_test.pgc index e3522fb736..3d62e694b7 100644 --- a/src/interfaces/ecpg/test/pgtypeslib/num_test.pgc +++ b/src/interfaces/ecpg/test/pgtypeslib/num_test.pgc @@ -5,6 +5,14 @@ exec sql include ../regression; + +/* + +NOTE: This file has a different expect file for regression tests on MinGW32 + +*/ + + int main(void) { diff --git a/src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc b/src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc index 4ad603a4ec..5a884f1040 100644 --- a/src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc +++ b/src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc @@ -6,6 +6,14 @@ exec sql include ../regression; + +/* + +NOTE: This file has a different expect file for regression tests on MinGW32 + +*/ + + char* nums[] = { "2E394", "-2", ".794", "3.44", "592.49E21", "-32.84e4", "2E-394", ".1E-2", "+.0", "-592.49E-07", "+32.84e-4", ".500001", "-.5000001", diff --git a/src/interfaces/ecpg/test/preproc/variable.pgc b/src/interfaces/ecpg/test/preproc/variable.pgc index 01594911dd..5836d6eb26 100644 --- a/src/interfaces/ecpg/test/preproc/variable.pgc +++ b/src/interfaces/ecpg/test/preproc/variable.pgc @@ -42,6 +42,9 @@ exec sql end declare section; strcpy(msg, "connect"); exec sql connect to REGRESSDB1; + strcpy(msg, "set"); + exec sql set datestyle to iso; + strcpy(msg, "create"); exec sql create table family(name char(8), born integer, age smallint, married date, children integer); -- 2.40.0