33{
34
35
36
37
38
39
40#line 17 "dt_test.pgc"
42
43#line 18 "dt_test.pgc"
45
46#line 19 "dt_test.pgc"
48
49#line 20 "dt_test.pgc"
51
52#line 21 "dt_test.pgc"
53
55 int mdy[3] = { 4, 19, 1998 };
56 char *fmt, *out, *in;
57 char *d1 = "Mon Jan 17 1966";
58 char *t1 = "2000-7-12 17:34:29";
60
62
63#line 30 "dt_test.pgc"
64
65 {
ECPGconnect(__LINE__, 0,
"ecpg1_regression" , NULL, NULL , NULL, 0);
66#line 31 "dt_test.pgc"
67
69#line 31 "dt_test.pgc"
70
72#line 32 "dt_test.pgc"
73
75#line 32 "dt_test.pgc"
76
78#line 33 "dt_test.pgc"
79
81#line 33 "dt_test.pgc"
82
84#line 34 "dt_test.pgc"
85
87#line 34 "dt_test.pgc"
88
89
92
93 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"insert into date_test ( d , ts ) values ( $1 , $2 )",
98#line 39 "dt_test.pgc"
99
101#line 39 "dt_test.pgc"
102
103
111#line 41 "dt_test.pgc"
112
114#line 41 "dt_test.pgc"
115
116
120
124
131
133 printf(
"m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
134
135 mdy[0] = mdy[1] = mdy[2] = 0;
136
137 printf(
"date seems to get encoded to julian %ld\n", date2);
138
140 printf(
"m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
141
144 fmt = "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
145 out = (
char*)
malloc(strlen(fmt) + 1);
149 printf(
"Above date in format \"%s\" is \"%s\"\n", fmt, out);
152
157
158
159
160
161 date1 = 0;
162 fmt = "yy/mm/dd";
163 in = "In the year 1995, the month of December, it is the 25th day";
164
165
166
171
172 date1 = 0;
173 fmt = "mmmm. dd. yyyy";
174 in = "12/25/95";
179
180 date1 = 0;
181 fmt = "yy/mm/dd";
182 in = "95/12/25";
187
188 date1 = 0;
189 fmt = "yy/mm/dd";
190 in = "1995, December 25th";
195
196 date1 = 0;
197 fmt = "dd-mm-yy";
198 in = "This is 25th day of December, 1995";
203
204 date1 = 0;
205 fmt = "mmddyy";
206 in = "Dec. 25th, 1995";
211
212 date1 = 0;
213 fmt = "mmm. dd. yyyy";
214 in = "dec 25th 1995";
219
220 date1 = 0;
221 fmt = "mmm. dd. yyyy";
222 in = "DEC-25-1995";
227
228 date1 = 0;
229 fmt = "mm yy dd.";
230 in = "12199525";
235
236 date1 = 0;
237 fmt = "yyyy fierj mm dd.";
238 in = "19951225";
243
244 date1 = 0;
245 fmt = "mm/dd/yy";
246 in = "122595";
251
254
255
257
262
267
269
274
276
281
282
283
284
287 printf(
"timestamp_fmt_asc: %d: %s\n",
i, out);
289
290 fmt = "This is a %m/%d/%y %H-%Ml%Stest";
291 in = "This is a 4/12/80 3-39l12test";
294 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
296
297 fmt = "%a %b %d %H:%M:%S %z %Y";
298 in = "Tue Jul 22 17:28:44 +0200 2003";
301 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
303
304 fmt = "%a %b %d %H:%M:%S %z %Y";
305 in = "Tue Feb 29 17:28:44 +0200 2000";
308 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
310
311 fmt = "%a %b %d %H:%M:%S %z %Y";
312 in = "Tue Feb 29 17:28:44 +0200 1900";
315 printf(
"timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt,
text,
i);
317
318 fmt = "%a %b %d %H:%M:%S %z %Y";
319 in = "Tue Feb 29 17:28:44 +0200 1996";
322 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
324
325 fmt = "%b %d %H:%M:%S %z %Y";
326 in = " Jul 31 17:28:44 +0200 1996";
329 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
331
332 fmt = "%b %d %H:%M:%S %z %Y";
333 in = " Jul 32 17:28:44 +0200 1996";
336 printf(
"timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt,
text,
i);
338
339 fmt = "%a %b %d %H:%M:%S %z %Y";
340 in = "Tue Feb 29 17:28:44 +0200 1997";
343 printf(
"timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt,
text,
i);
345
346 fmt = "%";
347 in = "Tue Jul 22 17:28:44 +0200 2003";
350 printf(
"timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt,
text,
i);
352
353 fmt = "a %";
354 in = "Tue Jul 22 17:28:44 +0200 2003";
357 printf(
"timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt,
text,
i);
359
360 fmt = "%b, %d %H_%M`%S %z %Y";
361 in = " Jul, 22 17_28 `44 +0200 2003 ";
364 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
366
367 fmt = "%a %b %%%d %H:%M:%S %Z %Y";
368 in = "Tue Jul %22 17:28:44 CEST 2003";
371 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
373
374 fmt = "%a %b %%%d %H:%M:%S %Z %Y";
375 in = "Tue Jul %22 17:28:44 CEST 2003";
378 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
380
381 fmt = "abc%n %C %B %%%d %H:%M:%S %Z %Y";
382 in = "abc\n 19 October %22 17:28:44 CEST 2003";
385 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
387
388 fmt = "abc%n %C %B %%%d %H:%M:%S %Z %y";
389 in = "abc\n 18 October %34 17:28:44 CEST 80";
392 printf(
"timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt,
text,
i);
394
395 fmt = "";
396 in = "abc\n 18 October %34 17:28:44 CEST 80";
399 printf(
"timestamp_defmt_asc(%s, %s) = %s, error (should be error!): %d\n", in, fmt,
text,
i);
401
402 fmt = NULL;
403 in = "1980-04-12 3:49:44 ";
406 printf(
"timestamp_defmt_asc(%s, NULL) = %s, error: %d\n", in,
text,
i);
408
409 fmt = "%B %d, %Y. Time: %I:%M%p";
410 in = "July 14, 1988. Time: 9:15am";
413 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
415
416 in = "September 6 at 01:30 pm in the year 1983";
417 fmt = "%B %d at %I:%M %p in the year %Y";
420 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
422
423 in = " 1976, July 14. Time: 9:15am";
424 fmt = "%Y, %B %d. Time: %I:%M %p";
427 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
429
430 in = " 1976, July 14. Time: 9:15 am";
431 fmt = "%Y, %B %d. Time: %I:%M%p";
434 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
436
437 in = " 1976, P.M. July 14. Time: 9:15";
438 fmt = "%Y, %P %B %d. Time: %I:%M";
441 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
443
444 in = "1234567890";
445 fmt = "%s";
448 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt,
text,
i);
450
452 fmt = "%a %b %d %H:%M:%S %Y";
453 in = "Mon Dec 30 17:28:44 2019";
456 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, out,
i);
458
460 fmt = "%a %b %d %H:%M:%S %Y";
461 in = "Mon December 30 17:28:44 2019";
464 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in, fmt, out,
i);
466
468#line 393 "dt_test.pgc"
469
471#line 393 "dt_test.pgc"
472
474#line 394 "dt_test.pgc"
475
477#line 394 "dt_test.pgc"
478
479
480 return 0;
481}
bool ECPGdisconnect(int lineno, const char *connection_name)
bool ECPGconnect(int lineno, int c, const char *name, const char *user, const char *passwd, const char *connection_name, int autocommit)
bool ECPGdo(const int lineno, const int compat, const int force_indicator, const char *connection_name, const bool questionmarks, const int st, const char *query,...)
bool ECPGtrans(int lineno, const char *connection_name, const char *transaction)
void PGTYPESchar_free(char *ptr)
date PGTYPESdate_from_timestamp(timestamp dt)
int PGTYPESdate_dayofweek(date dDate)
char * PGTYPESdate_to_asc(date dDate)
date PGTYPESdate_from_asc(char *str, char **endptr)
int PGTYPESdate_fmt_asc(date dDate, const char *fmtstring, char *outbuf)
int PGTYPESdate_defmt_asc(date *d, const char *fmt, const char *str)
void PGTYPESdate_julmdy(date jd, int *mdy)
void PGTYPESdate_mdyjul(int *mdy, date *jdate)
void PGTYPESinterval_free(interval *intvl)
int PGTYPESinterval_copy(interval *intvlsrc, interval *intvldest)
interval * PGTYPESinterval_from_asc(char *str, char **endptr)
char * PGTYPESinterval_to_asc(interval *span)
timestamp PGTYPEStimestamp_from_asc(char *str, char **endptr)
char * PGTYPEStimestamp_to_asc(timestamp tstamp)
void PGTYPEStimestamp_current(timestamp *ts)
int PGTYPEStimestamp_fmt_asc(timestamp *ts, char *output, int str_len, const char *fmtstr)
int PGTYPEStimestamp_defmt_asc(const char *str, const char *fmt, timestamp *d)
static void check_errno(void)