@@ -70,6 +70,7 @@ main(void)
70
70
71
71
72
72
73
+
73
74
74
75
#line 51 "dt_test2.pgc"
75
76
date date1 ;
@@ -82,8 +83,11 @@ main(void)
82
83
83
84
#line 54 "dt_test2.pgc"
84
85
interval * i1 ;
85
- /* exec sql end declare section */
86
+
86
87
#line 55 "dt_test2.pgc"
88
+ date * dc ;
89
+ /* exec sql end declare section */
90
+ #line 56 "dt_test2.pgc"
87
91
88
92
89
93
int i , j ;
@@ -98,9 +102,12 @@ main(void)
98
102
free (text );
99
103
100
104
date1 = PGTYPESdate_from_timestamp (ts1 );
101
- text = PGTYPESdate_to_asc (date1 );
105
+ dc = PGTYPESdate_new ();
106
+ * dc = date1 ;
107
+ text = PGTYPESdate_to_asc (* dc );
102
108
printf ("Date of timestamp: %s\n" , text );
103
109
free (text );
110
+ PGTYPESdate_free (dc );
104
111
105
112
for (i = 0 ; dates [i ]; i ++ )
106
113
{
@@ -139,6 +146,7 @@ main(void)
139
146
140
147
for (i = 0 ; intervals [i ]; i ++ )
141
148
{
149
+ interval * ic ;
142
150
i1 = PGTYPESinterval_from_asc (intervals [i ], & endptr );
143
151
if (* endptr )
144
152
printf ("endptr set to %s\n" , endptr );
@@ -153,6 +161,13 @@ main(void)
153
161
text = PGTYPESinterval_to_asc (i1 );
154
162
printf ("interval[%d]: %s\n" , i , text ? text : "-" );
155
163
free (text );
164
+
165
+ ic = PGTYPESinterval_new ();
166
+ PGTYPESinterval_copy (i1 , ic );
167
+ text = PGTYPESinterval_to_asc (i1 );
168
+ printf ("interval_copy[%d]: %s\n" , i , text ? text : "-" );
169
+ free (text );
170
+ PGTYPESinterval_free (ic );
156
171
}
157
172
158
173
return (0 );
0 commit comments