aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2003-09-20 09:10:09 +0000
committerMichael Meskes <meskes@postgresql.org>2003-09-20 09:10:09 +0000
commitf604b39c2f2230cfb783bce36dff4407f30be0d0 (patch)
tree29bbbd4b73c140e0439c395158ae75565ae6eec2 /src
parentf72a93b4c915aaccb4f4ef3af693c167d9591405 (diff)
downloadpostgresql-f604b39c2f2230cfb783bce36dff4407f30be0d0.tar.gz
postgresql-f604b39c2f2230cfb783bce36dff4407f30be0d0.zip
- Applied some bug fixing patches by Dave Cramer <dave@fastcrypt.com>.
- Added protecting defines to include files.
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/ecpg/ChangeLog6
-rw-r--r--src/interfaces/ecpg/ecpglib/data.c8
-rw-r--r--src/interfaces/ecpg/include/datetime.h5
-rw-r--r--src/interfaces/ecpg/include/decimal.h5
-rw-r--r--src/interfaces/ecpg/include/ecpg_informix.h4
-rw-r--r--src/interfaces/ecpg/include/ecpgerrno.h6
-rw-r--r--src/interfaces/ecpg/include/sql3types.h7
-rw-r--r--src/interfaces/ecpg/include/sqltypes.h5
-rw-r--r--src/interfaces/ecpg/pgtypeslib/numeric.c2
-rw-r--r--src/interfaces/ecpg/pgtypeslib/timestamp.c2
10 files changed, 42 insertions, 8 deletions
diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index a8724fbd7ce..8146eb0e09e 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -1639,6 +1639,12 @@ Thu Sep 18 14:54:47 CEST 2003
Fri Sep 19 08:33:39 CEST 2003
- Some code cleanup
+
+Sat Sep 20 11:06:13 CEST 2003
+
+ - Applied some bug fixing patches by Dave Cramer <dave@fastcrypt.com>.
+ - Added protecting defines to include files.
+ - Renamed my own strndup() function because of a name clash.
- Set ecpg version to 3.0.0
- Set ecpg library to 4.0.0
- Set pgtypes library to 1.0.0
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index 8be86b0bc2d..e1cfc3d2e7c 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.19 2003/09/19 14:06:21 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.20 2003/09/20 09:10:09 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -393,10 +393,12 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
/* did we get an error? */
if (errno != 0)
{
+ ECPGlog("ECPGget_data line %d: RESULT: %s errno %d\n", lineno, pval ? pval : "", errno);
+
if (INFORMIX_MODE(compat))
{
/* Informix wants its own NULL value here instead of an error */
- ECPGset_informix_null(ECPGt_numeric, &nres);
+ ECPGset_informix_null(ECPGt_numeric, nres);
}
else
{
@@ -440,7 +442,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
if (INFORMIX_MODE(compat))
{
/* Informix wants its own NULL value here instead of an error */
- ECPGset_informix_null(ECPGt_interval, &ires);
+ ECPGset_informix_null(ECPGt_interval, ires);
}
else
{
diff --git a/src/interfaces/ecpg/include/datetime.h b/src/interfaces/ecpg/include/datetime.h
index 4e0773efad0..c40398da0f4 100644
--- a/src/interfaces/ecpg/include/datetime.h
+++ b/src/interfaces/ecpg/include/datetime.h
@@ -1,3 +1,6 @@
+#ifndef _ECPG_DATETIME_H
+#define _ECPG_DATETIME_H
+
#include <pgtypes_timestamp.h>
#include <pgtypes_interval.h>
@@ -11,3 +14,5 @@ extern int dttoasc(dtime_t *, char *);
extern int dttofmtasc(dtime_t *, char *, int, char *);
extern int intoasc(intrvl_t *, char *);
extern int dtcvfmtasc(char *, char *, dtime_t *);
+
+#endif /* ndef _ECPG_DATETIME_H */
diff --git a/src/interfaces/ecpg/include/decimal.h b/src/interfaces/ecpg/include/decimal.h
index c1f724fbd29..eff42c22ca3 100644
--- a/src/interfaces/ecpg/include/decimal.h
+++ b/src/interfaces/ecpg/include/decimal.h
@@ -1,3 +1,6 @@
+#ifndef _ECPG_DECIMAL_H
+#define _ECPG_DECIMAL_H
+
#include <pgtypes_numeric.h>
typedef decimal dec_t;
@@ -16,3 +19,5 @@ int dectoasc(dec_t *, char *, int, int);
int dectodbl(dec_t *, double *);
int dectoint(dec_t *, int *);
int dectolong(dec_t *, long *);
+
+#endif /* ndef _ECPG_DECIMAL_H */
diff --git a/src/interfaces/ecpg/include/ecpg_informix.h b/src/interfaces/ecpg/include/ecpg_informix.h
index b7a57fab3b5..aea118ef18d 100644
--- a/src/interfaces/ecpg/include/ecpg_informix.h
+++ b/src/interfaces/ecpg/include/ecpg_informix.h
@@ -1,3 +1,5 @@
+#ifndef _ECPG_INFORMIX_H
+#define _ECPG_INFORMIX_H
/*
* This file contains stuff needed to be as compatible to Informix as possible.
*/
@@ -32,3 +34,5 @@ extern void ldchar(char *, int, char *);
extern void ECPG_informix_set_var(int, void *, int);
extern void *ECPG_informix_get_var(int);
+
+#endif /* ndef _ECPG_INFORMIX_H */
diff --git a/src/interfaces/ecpg/include/ecpgerrno.h b/src/interfaces/ecpg/include/ecpgerrno.h
index 7a551551541..87a30ef6ca7 100644
--- a/src/interfaces/ecpg/include/ecpgerrno.h
+++ b/src/interfaces/ecpg/include/ecpgerrno.h
@@ -1,5 +1,5 @@
-#ifndef _ECPG_ERROR_H
-#define _ECPG_ERROR_H
+#ifndef _ECPG_ERRNO_H
+#define _ECPG_ERRNO_H
#include <errno.h>
@@ -74,4 +74,4 @@
/* WARNING: BlankPortalAssignName: portal * already exists */
#define ECPG_WARNING_PORTAL_EXISTS -605
-#endif /* !_ECPG_ERROR_H */
+#endif /* !_ECPG_ERRNO_H */
diff --git a/src/interfaces/ecpg/include/sql3types.h b/src/interfaces/ecpg/include/sql3types.h
index 74a6d2192ec..4dfaa2d4945 100644
--- a/src/interfaces/ecpg/include/sql3types.h
+++ b/src/interfaces/ecpg/include/sql3types.h
@@ -1,8 +1,11 @@
+#ifndef _ECPG_SQL3TYPES_H
+#define _ECPG_SQL3TYPES_H
+
/* SQL3 dynamic type codes
*
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
*
- * $Header: /cvsroot/pgsql/src/interfaces/ecpg/include/sql3types.h,v 1.7 2001/10/28 06:26:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/include/sql3types.h,v 1.8 2003/09/20 09:10:09 meskes Exp $
*/
/* chapter 13.1 table 2: Codes used for SQL data types in Dynamic SQL */
@@ -41,3 +44,5 @@ enum
SQL3_DDT_ILLEGAL /* not a datetime data type (not part of
* standard) */
};
+
+#endif /* !_ECPG_SQL3TYPES_H */
diff --git a/src/interfaces/ecpg/include/sqltypes.h b/src/interfaces/ecpg/include/sqltypes.h
index f8e00c16844..522e6977aa6 100644
--- a/src/interfaces/ecpg/include/sqltypes.h
+++ b/src/interfaces/ecpg/include/sqltypes.h
@@ -1,3 +1,6 @@
+#ifndef ECPG_SQLTYPES_H
+#define ECPG_SQLTYPES_H
+
#define CCHARTYPE ECPGt_char
#define CSHORTTYPE ECPGt_short
#define CINTTYPE ECPGt_int
@@ -23,3 +26,5 @@
#define CROWTYPE 123
#define CLVCHARPTRTYPE 124
#define CTYPEMAX 25
+
+#endif /* ndef ECPG_SQLTYPES_H */
diff --git a/src/interfaces/ecpg/pgtypeslib/numeric.c b/src/interfaces/ecpg/pgtypeslib/numeric.c
index c4db7983952..569bcb23b4f 100644
--- a/src/interfaces/ecpg/pgtypeslib/numeric.c
+++ b/src/interfaces/ecpg/pgtypeslib/numeric.c
@@ -146,6 +146,7 @@ set_var_from_str(char *str, char **ptr, numeric *dest)
bool have_dp = FALSE;
int i = 0;
+ errno = 0;
*ptr = str;
while (*(*ptr))
{
@@ -1386,6 +1387,7 @@ PGTYPESnumeric_copy(numeric *src, numeric *dst)
{
int i;
+ if ( dst == NULL ) return -1;
zero_var(dst);
dst->weight = src->weight;
diff --git a/src/interfaces/ecpg/pgtypeslib/timestamp.c b/src/interfaces/ecpg/pgtypeslib/timestamp.c
index 38f735167c2..473fad5af97 100644
--- a/src/interfaces/ecpg/pgtypeslib/timestamp.c
+++ b/src/interfaces/ecpg/pgtypeslib/timestamp.c
@@ -573,7 +573,7 @@ dttofmtasc_replace(timestamp *ts, date dDate, int dow, struct tm * tm,
break;
case 'S':
replace_val.uint_val = tm->tm_sec;
- replace_type = PGTYPES_TYPE_UINT;
+ replace_type = PGTYPES_TYPE_UINT_2_LZ;
break;
case 't':
replace_val.char_val = '\t';