- Fixed initialization bug in compatlib.
- Added postgres_fe.h to all files in pgtypeslib.
+
+Fri Jul 4 13:51:11 CEST 2003
+
+ - date, interval and timestamp data should be quoted.
- Set ecpg version to 3.0.0
- Set ecpg library to 4.0.0
- Set pgtypes library to 1.0.0
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.15 2003/07/04 11:30:48 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.16 2003/07/04 12:00:52 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
{
for (element = 0; element < var->arrsize; element++)
{
- str = PGTYPESinterval_to_asc((Interval *)((var + var->offset * element)->value));
+ str = quote_postgres(PGTYPESinterval_to_asc((Interval *)((var + var->offset * element)->value)), stmt->lineno);
slen = strlen (str);
if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + 5, stmt->lineno)))
}
else
{
- str = PGTYPESinterval_to_asc((Interval *)(var->value));
+ str = quote_postgres(PGTYPESinterval_to_asc((Interval *)(var->value)), stmt->lineno);
slen = strlen (str);
if (!(mallocedval = ECPGalloc(slen + 1, stmt->lineno)))
{
for (element = 0; element < var->arrsize; element++)
{
- str = PGTYPESdate_to_asc(*(Date *)((var + var->offset * element)->value));
+ str = quote_postgres(PGTYPESdate_to_asc(*(Date *)((var + var->offset * element)->value)), stmt->lineno);
slen = strlen (str);
if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + 5, stmt->lineno)))
}
else
{
- str = PGTYPESdate_to_asc(*(Date *)(var->value));
+ str = quote_postgres(PGTYPESdate_to_asc(*(Date *)(var->value)), stmt->lineno);
slen = strlen (str);
if (!(mallocedval = ECPGalloc(slen + 1, stmt->lineno)))
{
for (element = 0; element < var->arrsize; element++)
{
- str = PGTYPEStimestamp_to_asc(*(Timestamp *)((var + var->offset * element)->value));
+ str = quote_postgres(PGTYPEStimestamp_to_asc(*(Timestamp *)((var + var->offset * element)->value)), stmt->lineno);
slen = strlen (str);
if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + 5, stmt->lineno)))
}
else
{
- str = PGTYPEStimestamp_to_asc(*(Timestamp *)(var->value));
+ str = quote_postgres(PGTYPEStimestamp_to_asc(*(Timestamp *)(var->value)), stmt->lineno);
slen = strlen (str);
if (!(mallocedval = ECPGalloc(slen + 1, stmt->lineno)))
Date date2;
int mdy[3] = { 4, 19, 1998 };
char *fmt, *out, *in;
+ char *d1 = "Mon Jan 17 1966";
+ char *t1 = "2000-7-12 17:34:29";
FILE *dbgs;
exec sql whenever sqlerror do sqlprint();
exec sql connect to mm;
exec sql create table date_test (d date, ts timestamp, iv interval);
+ exec sql set datestyle to iso;
- exec sql insert into date_test(d, ts, iv) values ('Mon Jan 17 1966', '2000-7-12 17:34:29', now()-'Mon Jan 17 1966');
+ date1 = PGTYPESdate_from_asc(d1, NULL);
+ ts1 = PGTYPEStimestamp_from_asc(t1, NULL);
+
+ exec sql insert into date_test(d, ts, iv) values (:date1, :ts1, now()-'Mon Jan 17 1966');
exec sql select * into :date1, :ts1 , :iv1 from date_test;
text = PGTYPESinterval_to_asc(&iv1);
printf ("interval: %s\n", text);
-
+
PGTYPESdate_mdyjul(mdy, &date2);
printf("m: %d, d: %d, y: %d\n", mdy[0], mdy[1], mdy[2]);
/* reset */