1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-26 23:43:30 +03:00

Made sure sqlca is reset for declare cursor in Informix mode as pointed out by

Böszörményi Zoltán <zb@cybertec.at>.
This commit is contained in:
Michael Meskes
2009-08-14 13:28:22 +00:00
parent c74d8a7708
commit cf37d68467
12 changed files with 135 additions and 73 deletions

View File

@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.44 2009/08/07 10:51:20 meskes Exp $
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.45 2009/08/14 13:28:22 meskes Exp $
#
#-------------------------------------------------------------------------
@@ -15,7 +15,7 @@ include $(top_builddir)/src/Makefile.global
NAME= ecpg_compat
SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 1
SO_MINOR_VERSION= 2
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) -I$(top_srcdir)/src/include/utils $(CPPFLAGS)

View File

@@ -1,4 +1,4 @@
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/exports.txt,v 1.4 2007/10/04 17:49:31 meskes Exp $
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/exports.txt,v 1.5 2009/08/14 13:28:22 meskes Exp $
# Functions to be exported by ecpg_compatlib DLL
ECPG_informix_get_var 1
ECPG_informix_set_var 2
@@ -41,3 +41,4 @@ rtypwidth 38
rupshift 39
ldchar 40
byleng 41
ECPG_informix_reset_sqlca 42

View File

@@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.59 2009/06/11 14:49:13 momjian Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.60 2009/08/14 13:28:22 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -16,6 +16,34 @@
#include <sqlca.h>
#include <ecpgerrno.h>
/* this is also defined in ecpglib/misc.c, by defining it twice we don't have to export the symbol */
static struct sqlca_t sqlca_init =
{
{
'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '
},
sizeof(struct sqlca_t),
0,
{
0,
{
0
}
},
{
'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '
},
{
0, 0, 0, 0, 0, 0
},
{
0, 0, 0, 0, 0, 0, 0, 0
},
{
'0', '0', '0', '0', '0'
}
};
static int
deccall2(decimal *arg1, decimal *arg2, int (*ptr) (numeric *, numeric *))
{
@@ -1033,6 +1061,14 @@ ECPG_informix_get_var(int number)
return (ptr) ? ptr->pointer : NULL;
}
void
ECPG_informix_reset_sqlca(void)
{
struct sqlca_t *sqlca = ECPGget_sqlca();
memcpy((char *) sqlca, (char *) &sqlca_init, sizeof(struct sqlca_t));
}
int
rsetnull(int t, char *ptr)
{