Skip to content

Commit 999f129

Browse files
author
Michael Meskes
committed
Moved Informix stuff to its own compat library. Interval datetype is now fully functional.
1 parent 82a91eb commit 999f129

File tree

14 files changed

+807
-346
lines changed

14 files changed

+807
-346
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,17 @@ Thu Mar 27 15:23:58 CET 2003
13761376
- Some more updates to pgtypeslib.
13771377
- Set optimization to -O1 until I find the reason why code is broken
13781378
with -O2.
1379+
1380+
Sat Mar 29 22:03:16 CET 2003
1381+
1382+
- Moved Informix compatibility stuff its own library.
1383+
- Added interval datetypes.
1384+
1385+
Sun Mar 30 13:43:13 CEST 2003
1386+
1387+
- Interval datetype now fully functional.
13791388
- Set ecpg version to 2.12.0.
13801389
- Set ecpg library to 3.4.2.
13811390
- Set pgtypes library to 1.0.0
1391+
- Set compat library to 1.0.0
13821392

src/interfaces/ecpg/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ all install installdirs uninstall dep depend distprep:
66
$(MAKE) -C include $@
77
$(MAKE) -C ecpglib $@
88
$(MAKE) -C pgtypeslib $@
9+
$(MAKE) -C compatlib $@
910
$(MAKE) -C preproc $@
1011

1112
clean distclean maintainer-clean:
1213
-$(MAKE) -C include $@
1314
-$(MAKE) -C ecpglib $@
1415
-$(MAKE) -C pgtypeslib $@
16+
-$(MAKE) -C compatlib $@
1517
-$(MAKE) -C preproc $@
1618
-$(MAKE) -C test clean

src/interfaces/ecpg/ecpglib/execute.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.6 2003/03/27 14:29:17 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.7 2003/03/30 11:48:18 meskes Exp $ */
22

33
/*
44
* The aim is to get a simpler inteface to the database routines.
@@ -847,7 +847,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
847847
{
848848
for (element = 0; element < var->arrsize; element++)
849849
{
850-
str = PGTYPESnumeric_ntoa((Numeric *)((var + var->offset * element)->value));
850+
str = PGTYPESnumeric_ntoa((Numeric *)((var + var->offset * element)->value), 0);
851851
slen = strlen (str);
852852

853853
if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + 5, stmt->lineno)))
@@ -863,7 +863,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
863863
}
864864
else
865865
{
866-
str = PGTYPESnumeric_ntoa((Numeric *)(var->value));
866+
str = PGTYPESnumeric_ntoa((Numeric *)(var->value), 0);
867867
slen = strlen (str);
868868

869869
if (!(mallocedval = ECPGalloc(slen + 1, stmt->lineno)))
@@ -1239,7 +1239,9 @@ ECPGexecute(struct statement * stmt)
12391239
{
12401240
ECPGlog("ECPGexecute line %d: ASYNC NOTIFY of '%s' from backend pid '%d' received\n",
12411241
stmt->lineno, notify->relname, notify->be_pid);
1242-
PQfreemem(notify);
1242+
/* PQfreemem(notify);*/
1243+
free(notify);
1244+
#warning Remove PQfreemem define
12431245
}
12441246

12451247
return status;

src/interfaces/ecpg/include/ecpg_informix.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
* This file contains stuff needed to be as compatible to Informix as possible.
33
*/
44

5+
#include <decimal.h>
6+
#include <datetime.h>
7+
58
#define SQLNOTFOUND 100
69

710
#ifndef Date
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
#ifndef PGTYPES_DATETIME
22
#define PGTYPES_DATETIME
33

4+
#include <pgtypes_timestamp.h>
5+
46
#define Date long
57

68
extern Date PGTYPESdate_atod(char *, char **);
79
extern char *PGTYPESdate_dtoa(Date);
8-
extern int PGTYPESdate_julmdy(Date, int*);
9-
extern int PGTYPESdate_mdyjul(int*, Date *);
10-
extern int PGTYPESdate_day(Date);
11-
10+
extern Date PGTYPESdate_ttod(Timestamp);
11+
extern void PGTYPESdate_julmdy(Date, int*);
12+
extern void PGTYPESdate_mdyjul(int*, Date *);
13+
extern int PGTYPESdate_dayofweek(Date);
14+
extern void PGTYPESdate_today (Date *);
15+
extern int PGTYPESdate_defmtdate(Date *, char *, char *);
16+
extern int PGTYPESdate_fmtdate(Date, char *, char *);
1217
#endif /* PGTYPES_DATETIME */
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
#define PGTYPES_OVERFLOW 201
2-
#define PGTYPES_BAD_NUMERIC 202
3-
#define PGTYPES_DIVIDE_ZERO 203
1+
#define PGTYPES_NUM_OVERFLOW 201
2+
#define PGTYPES_NUM_BAD_NUMERIC 202
3+
#define PGTYPES_NUM_DIVIDE_ZERO 203
44

5-
#define PGTYPES_BAD_DATE 210
5+
#define PGTYPES_DATE_BAD_DATE 210
6+
#define PGTYPES_DATE_ERR_EARGS 211
7+
#define PGTYPES_DATE_ERR_ENOSHORTDATE 212
8+
#define PGTYPES_DATE_ERR_ENOTDMY 213
9+
#define PGTYPES_DATE_BAD_DAY 214
10+
#define PGTYPES_DATE_BAD_MONTH 215
611

7-
#define PGTYPES_BAD_TIMESTAMP 220
12+
#define PGTYPES_TS_BAD_TIMESTAMP 220
13+
14+
#define PGTYPES_INTVL_BAD_INTERVAL 230
815

src/interfaces/ecpg/include/pgtypes_numeric.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ typedef struct
2323
Numeric *PGTYPESnew(void);
2424
void PGTYPESnumeric_free(Numeric *);
2525
Numeric *PGTYPESnumeric_aton(char *, char **);
26-
char *PGTYPESnumeric_ntoa(Numeric *);
26+
char *PGTYPESnumeric_ntoa(Numeric *, int);
2727
int PGTYPESnumeric_add(Numeric *, Numeric *, Numeric *);
2828
int PGTYPESnumeric_sub(Numeric *, Numeric *, Numeric *);
2929
int PGTYPESnumeric_mul(Numeric *, Numeric *, Numeric *);

src/interfaces/ecpg/pgtypeslib/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.3 2003/03/27 14:29:17 meskes Exp $
7+
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.4 2003/03/30 11:48:18 meskes Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -18,7 +18,7 @@ SO_MINOR_VERSION= 0.0
1818

1919
override CPPFLAGS := -O1 -g -I$(top_srcdir)/src/interfaces/ecpg/include -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
2020

21-
OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o
21+
OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o interval.o
2222

2323
all: all-lib
2424

0 commit comments

Comments
 (0)