7 #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
19 #line 1 "regression.h"
40 #line 17 "dt_test.pgc"
43 #line 18 "dt_test.pgc"
46 #line 19 "dt_test.pgc"
49 #line 20 "dt_test.pgc"
52 #line 21 "dt_test.pgc"
55 int mdy[3] = { 4, 19, 1998 };
57 char *d1 =
"Mon Jan 17 1966";
58 char *t1 =
"2000-7-12 17:34:29";
63 #line 30 "dt_test.pgc"
65 {
ECPGconnect(__LINE__, 0,
"ecpg1_regression" , NULL, NULL , NULL, 0);
66 #line 31 "dt_test.pgc"
69 #line 31 "dt_test.pgc"
72 #line 32 "dt_test.pgc"
75 #line 32 "dt_test.pgc"
78 #line 33 "dt_test.pgc"
81 #line 33 "dt_test.pgc"
84 #line 34 "dt_test.pgc"
87 #line 34 "dt_test.pgc"
93 {
ECPGdo(__LINE__, 0, 1, NULL, 0,
ECPGst_normal,
"insert into date_test ( d , ts ) values ( $1 , $2 )",
98 #line 39 "dt_test.pgc"
101 #line 39 "dt_test.pgc"
111 #line 41 "dt_test.pgc"
114 #line 41 "dt_test.pgc"
133 printf(
"m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
135 mdy[0] = mdy[1] = mdy[2] = 0;
137 printf(
"date seems to get encoded to julian %ld\n", date2);
140 printf(
"m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
144 fmt =
"(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
149 printf(
"Above date in format \"%s\" is \"%s\"\n",
fmt, out);
163 in =
"In the year 1995, the month of December, it is the 25th day";
173 fmt =
"mmmm. dd. yyyy";
190 in =
"1995, December 25th";
198 in =
"This is 25th day of December, 1995";
206 in =
"Dec. 25th, 1995";
213 fmt =
"mmm. dd. yyyy";
214 in =
"dec 25th 1995";
221 fmt =
"mmm. dd. yyyy";
237 fmt =
"yyyy fierj mm dd.";
287 printf(
"timestamp_fmt_asc: %d: %s\n",
i, out);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
403 in =
"1980-04-12 3:49:44 ";
406 printf(
"timestamp_defmt_asc(%s, NULL) = %s, error: %d\n", in,
text,
i);
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);
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);
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);
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);
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);
448 printf(
"timestamp_defmt_asc(%s, %s) = %s, error: %d\n", in,
fmt,
text,
i);
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);
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);
468 #line 393 "dt_test.pgc"
471 #line 393 "dt_test.pgc"
474 #line 394 "dt_test.pgc"
477 #line 394 "dt_test.pgc"
489 printf(
"(no errno set) - ");
492 printf(
"(errno == PGTYPES_TS_BAD_TIMESTAMP) - ");
495 printf(
"(unknown errno (%d))\n", errno);
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)
static void const char * fmt
void PGTYPESchar_free(char *ptr)
date PGTYPESdate_from_timestamp(timestamp dt)
int PGTYPESdate_dayofweek(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)
char * PGTYPESdate_to_asc(date dDate)
#define PGTYPES_TS_BAD_TIMESTAMP
void PGTYPESinterval_free(interval *intvl)
char * PGTYPESinterval_to_asc(interval *span)
int PGTYPESinterval_copy(interval *intvlsrc, interval *intvldest)
interval * PGTYPESinterval_from_asc(char *str, char **endptr)
timestamp PGTYPEStimestamp_from_asc(char *str, char **endptr)
void PGTYPEStimestamp_current(timestamp *ts)
char * PGTYPEStimestamp_to_asc(timestamp tstamp)
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)