diff options
| author | Michael Meskes <meskes@postgresql.org> | 2006-09-14 08:02:38 +0000 |
|---|---|---|
| committer | Michael Meskes <meskes@postgresql.org> | 2006-09-14 08:02:38 +0000 |
| commit | 0f0d6765ce0b10b989df60d89f2f6f4661c72218 (patch) | |
| tree | 43f2c1fc436aa2c3ae6fc17a3feed3d9b21d5d4c /src/interfaces/ecpg/test | |
| parent | f8fe328c24f15ccb8cc7655bb75ef2a299934518 (diff) | |
| download | postgresql-0f0d6765ce0b10b989df60d89f2f6f4661c72218.tar.gz | |
Added missing constuctor/destructor for interval and date.
Diffstat (limited to 'src/interfaces/ecpg/test')
3 files changed, 36 insertions, 3 deletions
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c index c92f354ec4..e5388b6fa8 100644 --- a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c +++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.c @@ -70,6 +70,7 @@ main(void) + #line 51 "dt_test2.pgc" date date1 ; @@ -82,8 +83,11 @@ main(void) #line 54 "dt_test2.pgc" interval * i1 ; -/* exec sql end declare section */ + #line 55 "dt_test2.pgc" + date * dc ; +/* exec sql end declare section */ +#line 56 "dt_test2.pgc" int i, j; @@ -98,9 +102,12 @@ main(void) free(text); date1 = PGTYPESdate_from_timestamp(ts1); - text = PGTYPESdate_to_asc(date1); + dc = PGTYPESdate_new(); + *dc = date1; + text = PGTYPESdate_to_asc(*dc); printf("Date of timestamp: %s\n", text); free(text); + PGTYPESdate_free(dc); for (i = 0; dates[i]; i++) { @@ -139,6 +146,7 @@ main(void) for (i = 0; intervals[i]; i++) { + interval *ic; i1 = PGTYPESinterval_from_asc(intervals[i], &endptr); if (*endptr) printf("endptr set to %s\n", endptr); @@ -153,6 +161,13 @@ main(void) text = PGTYPESinterval_to_asc(i1); printf("interval[%d]: %s\n", i, text ? text : "-"); free(text); + + ic = PGTYPESinterval_new(); + PGTYPESinterval_copy(i1, ic); + text = PGTYPESinterval_to_asc(i1); + printf("interval_copy[%d]: %s\n", i, text ? text : "-"); + free(text); + PGTYPESinterval_free(ic); } return (0); diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout index 1a40893aed..24e9d26dfe 100644 --- a/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout +++ b/src/interfaces/ecpg/test/expected/pgtypeslib-dt_test2.stdout @@ -88,9 +88,15 @@ TS[19,0]: 0099-01-08 00:04:00 BC TS[19,1]: 0099-01-08 01:59:00 BC TS[19,2]: 0099-01-08 13:24:40 BC interval[0]: @ 1 min +interval_copy[0]: @ 1 min interval[1]: @ 1 day 12 hours 59 mins 10 secs +interval_copy[1]: @ 1 day 12 hours 59 mins 10 secs interval[2]: @ 2 days 12 hours 59 mins 10 secs +interval_copy[2]: @ 2 days 12 hours 59 mins 10 secs interval[3]: @ 1 day 12 hours 59 mins 10 secs +interval_copy[3]: @ 1 day 12 hours 59 mins 10 secs interval[4]: @ 1 day 1 hour 1 min 1 sec +interval_copy[4]: @ 1 day 1 hour 1 min 1 sec interval[5]: @ 1 year 59 mins +interval_copy[5]: @ 1 year 59 mins Error parsing interval 6 diff --git a/src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc b/src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc index 09a95f7aba..08d1d6c412 100644 --- a/src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc +++ b/src/interfaces/ecpg/test/pgtypeslib/dt_test2.pgc @@ -52,6 +52,7 @@ main(void) timestamp ts1, ts2; char *text; interval *i1; + date *dc; exec sql end declare section; int i, j; @@ -66,9 +67,12 @@ main(void) free(text); date1 = PGTYPESdate_from_timestamp(ts1); - text = PGTYPESdate_to_asc(date1); + dc = PGTYPESdate_new(); + *dc = date1; + text = PGTYPESdate_to_asc(*dc); printf("Date of timestamp: %s\n", text); free(text); + PGTYPESdate_free(dc); for (i = 0; dates[i]; i++) { @@ -107,6 +111,7 @@ main(void) for (i = 0; intervals[i]; i++) { + interval *ic; i1 = PGTYPESinterval_from_asc(intervals[i], &endptr); if (*endptr) printf("endptr set to %s\n", endptr); @@ -121,6 +126,13 @@ main(void) text = PGTYPESinterval_to_asc(i1); printf("interval[%d]: %s\n", i, text ? text : "-"); free(text); + + ic = PGTYPESinterval_new(); + PGTYPESinterval_copy(i1, ic); + text = PGTYPESinterval_to_asc(i1); + printf("interval_copy[%d]: %s\n", i, text ? text : "-"); + free(text); + PGTYPESinterval_free(ic); } return (0); |
