aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2003-06-20 13:36:34 +0000
committerMichael Meskes <meskes@postgresql.org>2003-06-20 13:36:34 +0000
commit2cbaaee6c3bd4f41470aa44d6a620de0e93d1036 (patch)
tree014d0850818f0d2326a9eb6c19e49111af5a7b4c /src
parentd9b2401d909c32eca81c44bf380a3f897e1cbf4e (diff)
downloadpostgresql-2cbaaee6c3bd4f41470aa44d6a620de0e93d1036.tar.gz
postgresql-2cbaaee6c3bd4f41470aa44d6a620de0e93d1036.zip
Just another Informix compatibility change. They uses "free" for cursors as wellafter closing them.
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/ecpg/ChangeLog4
-rw-r--r--src/interfaces/ecpg/compatlib/informix.c10
-rw-r--r--src/interfaces/ecpg/ecpglib/prepare.c15
-rw-r--r--src/interfaces/ecpg/include/ecpg_informix.h1
-rw-r--r--src/interfaces/ecpg/include/ecpglib.h1
-rw-r--r--src/interfaces/ecpg/preproc/preproc.y7
-rw-r--r--src/interfaces/ecpg/test/test4.pgc3
7 files changed, 36 insertions, 5 deletions
diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index 617d6588e20..42173f76ab8 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -1505,6 +1505,10 @@ Thu Jun 19 10:08:26 CEST 2003
Fri Jun 20 13:23:07 CEST 2003
- Enabled constants in using clause.
+
+Fri Jun 20 15:34:29 CEST 2003
+
+ - For Informix compatibility we have to accept a "free <cursor>".
- 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/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c
index 5e3e94b416f..2ac89e8f7e1 100644
--- a/src/interfaces/ecpg/compatlib/informix.c
+++ b/src/interfaces/ecpg/compatlib/informix.c
@@ -695,6 +695,16 @@ ECPGconnect_informix(int lineno, const char *name, const char *user, const char
return (ECPGconnect(lineno, informix_name, user, passwd, connection_name , autocommit));
}
+bool
+ECPGdeallocate_informix(int lineno, char *name)
+{
+ ECPGdeallocate_one(lineno, name);
+
+ /* Just ignore all errors since we do not know the list of cursors we
+ * are allowed to free. We have to trust that the software. */
+ return true;
+}
+
static struct var_list
{
int number;
diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c
index 7de8367184c..5f8c92c092c 100644
--- a/src/interfaces/ecpg/ecpglib/prepare.c
+++ b/src/interfaces/ecpg/ecpglib/prepare.c
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.2 2003/06/15 04:07:58 momjian Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.3 2003/06/20 13:36:34 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -107,6 +107,18 @@ ECPGprepare(int lineno, char *name, char *variable)
bool
ECPGdeallocate(int lineno, char *name)
{
+ bool ret = ECPGdeallocate_one(lineno, name);
+
+ if (!ret)
+ ECPGraise(lineno, ECPG_INVALID_STMT, name);
+
+ return ret;
+
+}
+
+bool
+ECPGdeallocate_one(int lineno, char *name)
+{
struct prepared_statement *this,
*prev;
@@ -126,7 +138,6 @@ ECPGdeallocate(int lineno, char *name)
ECPGfree(this);
return true;
}
- ECPGraise(lineno, ECPG_INVALID_STMT, name);
return false;
}
diff --git a/src/interfaces/ecpg/include/ecpg_informix.h b/src/interfaces/ecpg/include/ecpg_informix.h
index 4493dc6f29f..f7947866326 100644
--- a/src/interfaces/ecpg/include/ecpg_informix.h
+++ b/src/interfaces/ecpg/include/ecpg_informix.h
@@ -34,5 +34,6 @@ extern int byleng(char *, int);
extern void ldchar(char *, int, char *);
extern bool ECPGconnect_informix(int, const char *, const char *, const char *, const char *, int);
+extern bool ECPGdeallocate_informix(int, char *);
extern void ECPG_informix_set_var(int, void *, int);
extern void *ECPG_informix_get_var(int);
diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h
index da91927854c..ae272927c6f 100644
--- a/src/interfaces/ecpg/include/ecpglib.h
+++ b/src/interfaces/ecpg/include/ecpglib.h
@@ -51,6 +51,7 @@ bool ECPGtrans(int, const char *, const char *);
bool ECPGdisconnect(int, const char *);
bool ECPGprepare(int, char *, char *);
bool ECPGdeallocate(int, char *);
+bool ECPGdeallocate_one(int, char *);
bool ECPGdeallocate_all(int);
char *ECPGprepared_statement(char *);
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index 107d84251f5..7a8c2284bd2 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.235 2003/06/20 12:00:59 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.236 2003/06/20 13:36:34 meskes Exp $ */
/* Copyright comment */
%{
@@ -674,7 +674,10 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
}
| ECPGFree
{
- fprintf(yyout, "{ ECPGdeallocate(__LINE__, \"%s\");", $1);
+ if (compat == ECPG_COMPAT_INFORMIX)
+ fprintf(yyout, "{ ECPGdeallocate_informix(__LINE__, \"%s\");", $1);
+ else
+ fprintf(yyout, "{ ECPGdeallocate(__LINE__, \"%s\");", $1);
whenever_action(2);
free($1);
diff --git a/src/interfaces/ecpg/test/test4.pgc b/src/interfaces/ecpg/test/test4.pgc
index 31d4d278e58..7a4c49df53f 100644
--- a/src/interfaces/ecpg/test/test4.pgc
+++ b/src/interfaces/ecpg/test/test4.pgc
@@ -13,13 +13,14 @@ EXEC SQL BEGIN DECLARE SECTION;
int *did = &i;
int a[10] = {9,8,7,6,5,4,3,2,1,0};
char text[10] = "klmnopqrst";
- char *t = "uvwxyz1234";
+ char *t = (char *)malloc(10);
double f;
bool b = true;
varchar database[3];
EXEC SQL END DECLARE SECTION;
FILE *dbgs;
+ strcpy(t, "0123456789");
setlocale(LC_ALL, "de_DE");
if ((dbgs = fopen("log", "w")) != NULL)