4-pg85-outofscopedeclare-7-ctxdiff.patch
text/x-patch
Filename: 4-pg85-outofscopedeclare-7-ctxdiff.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
| File | + | − |
|---|---|---|
| src/interfaces/ecpg/preproc/descriptor.c | 1 | 1 |
| src/interfaces/ecpg/preproc/ecpg.addons | 5 | 2 |
| src/interfaces/ecpg/preproc/ecpg.header | 93 | 15 |
| src/interfaces/ecpg/preproc/ecpg.trailer | 31 | 8 |
| src/interfaces/ecpg/preproc/extern.h | 1 | 0 |
| src/interfaces/ecpg/preproc/pgc.l | 18 | 3 |
| src/interfaces/ecpg/preproc/type.c | 5 | 3 |
| src/interfaces/ecpg/preproc/type.h | 5 | 1 |
| src/interfaces/ecpg/preproc/variable.c | 3 | 3 |
| src/interfaces/ecpg/test/compat_informix/Makefile | 8 | 0 |
| src/interfaces/ecpg/test/compat_informix/outofscope.pgc | 256 | 0 |
| src/interfaces/ecpg/test/compat_informix/struct.h | 18 | 0 |
| src/interfaces/ecpg/test/compat_informix/struct.pgc | 76 | 0 |
| src/interfaces/ecpg/test/ecpg_schedule | 2 | 0 |
| src/interfaces/ecpg/test/ecpg_schedule_tcp | 2 | 0 |
| src/interfaces/ecpg/test/expected/compat_informix-cursor.c | 22 | 20 |
| src/interfaces/ecpg/test/expected/compat_informix-outofscope.c | 629 | 0 |
| src/interfaces/ecpg/test/expected/compat_informix-outofscope.stderr | 170 | 0 |
| src/interfaces/ecpg/test/expected/compat_informix-outofscope.stdout | 9 | 0 |
| src/interfaces/ecpg/test/expected/compat_informix-struct.c | 265 | 0 |
| src/interfaces/ecpg/test/expected/compat_informix-struct.stderr | 136 | 0 |
| src/interfaces/ecpg/test/expected/compat_informix-struct.stdout | 4 | 0 |
diff -dcrpN pgsql.3/src/interfaces/ecpg/preproc/descriptor.c pgsql.4/src/interfaces/ecpg/preproc/descriptor.c
*** pgsql.3/src/interfaces/ecpg/preproc/descriptor.c 2009-11-16 11:07:02.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/preproc/descriptor.c 2009-11-16 11:35:10.000000000 +0100
*************** struct variable *
*** 317,323 ****
descriptor_variable(const char *name, int input)
{
static char descriptor_names[2][MAX_DESCRIPTOR_NAMELEN];
! static const struct ECPGtype descriptor_type = {ECPGt_descriptor, NULL, NULL, {NULL}, 0};
static const struct variable varspace[2] = {
{descriptor_names[0], (struct ECPGtype *) & descriptor_type, 0, NULL},
{descriptor_names[1], (struct ECPGtype *) & descriptor_type, 0, NULL}
--- 317,323 ----
descriptor_variable(const char *name, int input)
{
static char descriptor_names[2][MAX_DESCRIPTOR_NAMELEN];
! static const struct ECPGtype descriptor_type = {ECPGt_descriptor, NULL, NULL, NULL, {NULL}, 0};
static const struct variable varspace[2] = {
{descriptor_names[0], (struct ECPGtype *) & descriptor_type, 0, NULL},
{descriptor_names[1], (struct ECPGtype *) & descriptor_type, 0, NULL}
diff -dcrpN pgsql.3/src/interfaces/ecpg/preproc/ecpg.addons pgsql.4/src/interfaces/ecpg/preproc/ecpg.addons
*** pgsql.3/src/interfaces/ecpg/preproc/ecpg.addons 2009-11-16 11:07:02.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/preproc/ecpg.addons 2009-11-16 11:35:10.000000000 +0100
*************** ECPG: DeclareCursorStmtDECLAREcursor_nam
*** 310,320 ****
--- 310,323 ----
this->next = cur;
this->name = $2;
+ this->function = (current_function ? mm_strdup(current_function) : NULL);
this->connection = connection;
this->opened = false;
this->command = cat_str(7, make_str("declare"), cursor_marker, $3, make_str("cursor"), $5, make_str("for"), $7);
this->argsinsert = argsinsert;
+ this->argsinsert_oos = NULL;
this->argsresult = argsresult;
+ this->argsresult_oos = NULL;
argsinsert = argsresult = NULL;
cur = this;
*************** ECPG: DeclareCursorStmtDECLAREcursor_nam
*** 324,333 ****
{
if (braces_open > 0) /* we're in a function */
{
! $$ = cat_str(4, adjust_informix(this->argsinsert), adjust_informix(this->argsresult), make_str("ECPG_informix_reset_sqlca();"), comment);
}
else
! $$ = cat_str(3, adjust_informix(this->argsinsert), adjust_informix(this->argsresult), comment);
}
else
$$ = comment;
--- 327,336 ----
{
if (braces_open > 0) /* we're in a function */
{
! $$ = cat_str(4, adjust_informix(this, true), adjust_informix(this, false), make_str("ECPG_informix_reset_sqlca();"), comment);
}
else
! $$ = cat_str(3, adjust_informix(this, true), adjust_informix(this, false), comment);
}
else
$$ = comment;
diff -dcrpN pgsql.3/src/interfaces/ecpg/preproc/ecpg.header pgsql.4/src/interfaces/ecpg/preproc/ecpg.header
*** pgsql.3/src/interfaces/ecpg/preproc/ecpg.header 2009-11-06 11:06:24.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/preproc/ecpg.header 2009-11-16 11:35:10.000000000 +0100
***************
*** 33,38 ****
--- 33,39 ----
*/
int struct_level = 0;
int braces_open; /* brace level counter */
+ char *current_function;
int ecpg_informix_var = 0;
char *connection = NULL;
char *input_filename = NULL;
*************** static char *ECPGstruct_sizeof = NULL;
*** 53,62 ****
/* for forward declarations we have to store some data as well */
static char *forward_name = NULL;
! struct ECPGtype ecpg_no_indicator = {ECPGt_NO_INDICATOR, NULL, NULL, {NULL}, 0};
struct variable no_indicator = {"no_indicator", &ecpg_no_indicator, 0, NULL};
! struct ECPGtype ecpg_query = {ECPGt_char_variable, NULL, NULL, {NULL}, 0};
/*
* Handle parsing errors and warnings
--- 54,63 ----
/* for forward declarations we have to store some data as well */
static char *forward_name = NULL;
! struct ECPGtype ecpg_no_indicator = {ECPGt_NO_INDICATOR, NULL, NULL, NULL, {NULL}, 0};
struct variable no_indicator = {"no_indicator", &ecpg_no_indicator, 0, NULL};
! struct ECPGtype ecpg_query = {ECPGt_char_variable, NULL, NULL, NULL, {NULL}, 0};
/*
* Handle parsing errors and warnings
*************** create_questionmarks(char *name, bool ar
*** 226,232 ****
}
static char *
! adjust_informix(struct arguments *list)
{
/* Informix accepts DECLARE with variables that are out of scope when OPEN is called.
* for instance you can declare variables in a function, and then subsequently use them
--- 227,233 ----
}
static char *
! adjust_informix(struct cursor *cur, bool insert)
{
/* Informix accepts DECLARE with variables that are out of scope when OPEN is called.
* for instance you can declare variables in a function, and then subsequently use them
*************** adjust_informix(struct arguments *list)
*** 240,301 ****
* We have to change the variables to our own struct and just store the pointer instead of the variable
*/
struct arguments *ptr;
char *result = make_str("");
for (ptr = list; ptr != NULL; ptr = ptr->next)
{
char temp[20]; /* this should be sufficient unless you have 8 byte integers */
char *original_var;
/* change variable name to "ECPG_informix_get_var(<counter>)" */
original_var = ptr->variable->name;
sprintf(temp, "%d))", ecpg_informix_var);
! if ((ptr->variable->type->type != ECPGt_varchar && ptr->variable->type->type != ECPGt_char && ptr->variable->type->type != ECPGt_unsigned_char && ptr->variable->type->type != ECPGt_string) && atoi(ptr->variable->type->size) > 1)
{
! ptr->variable = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, make_str("1"), ptr->variable->type->u.element->lineno), ptr->variable->type->size), 0);
sprintf(temp, "%d, (", ecpg_informix_var++);
}
else if ((ptr->variable->type->type == ECPGt_varchar || ptr->variable->type->type == ECPGt_char || ptr->variable->type->type == ECPGt_unsigned_char || ptr->variable->type->type == ECPGt_string) && atoi(ptr->variable->type->size) > 1)
{
! ptr->variable = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->lineno), 0);
! sprintf(temp, "%d, (", ecpg_informix_var++);
}
else
{
! ptr->variable = new_variable(cat_str(4, make_str("*("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->lineno), 0);
sprintf(temp, "%d, &(", ecpg_informix_var++);
}
/* create call to "ECPG_informix_set_var(<counter>, <pointer>. <linen number>)" */
! result = cat_str(5, result, make_str("ECPG_informix_set_var("), mm_strdup(temp), mm_strdup(original_var), make_str("), __LINE__);\n"));
/* now the indicator if there is one */
! if (ptr->indicator->type->type != ECPGt_NO_INDICATOR)
{
/* change variable name to "ECPG_informix_get_var(<counter>)" */
original_var = ptr->indicator->name;
sprintf(temp, "%d))", ecpg_informix_var);
/* create call to "ECPG_informix_set_var(<counter>, <pointer>. <linen number>)" */
! if (atoi(ptr->indicator->type->size) > 1)
{
! ptr->indicator = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->lineno), 0);
sprintf(temp, "%d, (", ecpg_informix_var++);
}
else
{
! ptr->indicator = new_variable(cat_str(4, make_str("*("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->lineno), 0);
sprintf(temp, "%d, &(", ecpg_informix_var++);
}
result = cat_str(5, result, make_str("ECPG_informix_set_var("), mm_strdup(temp), mm_strdup(original_var), make_str("), __LINE__);\n"));
}
}
return result;
}
static struct cursor *
add_additional_variables(char *name, bool insert)
{
--- 241,379 ----
* We have to change the variables to our own struct and just store the pointer instead of the variable
*/
+ struct arguments *list;
struct arguments *ptr;
+ struct arguments *newlist = NULL;
+ struct variable *newvar, *newind;
char *result = make_str("");
+ list = (insert ? cur->argsinsert : cur->argsresult);
+
for (ptr = list; ptr != NULL; ptr = ptr->next)
{
char temp[20]; /* this should be sufficient unless you have 8 byte integers */
char *original_var;
+ bool skip_set_var = false;
/* change variable name to "ECPG_informix_get_var(<counter>)" */
original_var = ptr->variable->name;
sprintf(temp, "%d))", ecpg_informix_var);
! /* Don't emit ECPGinformix_set_var() calls for global variables */
! if (ptr->variable->brace_level == 0)
{
! newvar = ptr->variable;
! skip_set_var = true;
! }
! else if ((ptr->variable->type->type == ECPGt_char_variable) && (!strncmp(ptr->variable->name, "ECPGprepared_statement", strlen("ECPGprepared_statement"))))
! {
! newvar = ptr->variable;
! skip_set_var = true;
! }
! else if ((ptr->variable->type->type != ECPGt_varchar && ptr->variable->type->type != ECPGt_char && ptr->variable->type->type != ECPGt_unsigned_char && ptr->variable->type->type != ECPGt_string) && atoi(ptr->variable->type->size) > 1)
! {
! newvar = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, make_str("1"), ptr->variable->type->u.element->lineno), ptr->variable->type->size), 0);
sprintf(temp, "%d, (", ecpg_informix_var++);
}
else if ((ptr->variable->type->type == ECPGt_varchar || ptr->variable->type->type == ECPGt_char || ptr->variable->type->type == ECPGt_unsigned_char || ptr->variable->type->type == ECPGt_string) && atoi(ptr->variable->type->size) > 1)
{
! newvar = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->lineno), 0);
! if (ptr->variable->type->type == ECPGt_varchar)
! sprintf(temp, "%d, &(", ecpg_informix_var++);
! else
! sprintf(temp, "%d, (", ecpg_informix_var++);
! }
! else if (ptr->variable->type->type == ECPGt_struct || ptr->variable->type->type == ECPGt_union)
! {
! sprintf(temp, "%d)))", ecpg_informix_var);
! newvar = new_variable(cat_str(4, make_str("(*("), mm_strdup(ptr->variable->type->type_name), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_struct_type(ptr->variable->type->u.members, ptr->variable->type->type, ptr->variable->type->type_name, ptr->variable->type->struct_sizeof), 0);
! sprintf(temp, "%d, &(", ecpg_informix_var++);
! }
! else if (ptr->variable->type->type == ECPGt_array)
! {
! if (ptr->variable->type->u.element->type == ECPGt_struct || ptr->variable->type->u.element->type == ECPGt_union)
! {
! sprintf(temp, "%d)))", ecpg_informix_var);
! newvar = new_variable(cat_str(4, make_str("(*("), mm_strdup(ptr->variable->type->u.element->type_name), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_struct_type(ptr->variable->type->u.element->u.members, ptr->variable->type->u.element->type, ptr->variable->type->u.element->type_name, ptr->variable->type->u.element->struct_sizeof), 0);
! sprintf(temp, "%d, (", ecpg_informix_var++);
! }
! else
! {
! newvar = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, ptr->variable->type->u.element->size, ptr->variable->type->u.element->lineno), ptr->variable->type->size), 0);
! sprintf(temp, "%d, &(", ecpg_informix_var++);
! }
}
else
{
! newvar = new_variable(cat_str(4, make_str("*("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->lineno), 0);
sprintf(temp, "%d, &(", ecpg_informix_var++);
}
/* create call to "ECPG_informix_set_var(<counter>, <pointer>. <linen number>)" */
! if (!skip_set_var)
! result = cat_str(5, result, make_str("ECPG_informix_set_var("), mm_strdup(temp), mm_strdup(original_var), make_str("), __LINE__);\n"));
/* now the indicator if there is one */
! if ((ptr->indicator->type->type == ECPGt_NO_INDICATOR) || (ptr->indicator->brace_level == 0))
! {
! newind = ptr->indicator;
! }
! else
{
/* change variable name to "ECPG_informix_get_var(<counter>)" */
original_var = ptr->indicator->name;
sprintf(temp, "%d))", ecpg_informix_var);
/* create call to "ECPG_informix_set_var(<counter>, <pointer>. <linen number>)" */
! if (ptr->indicator->type->type == ECPGt_struct || ptr->indicator->type->type == ECPGt_union)
{
! sprintf(temp, "%d)))", ecpg_informix_var);
! newind = new_variable(cat_str(4, make_str("(*("), mm_strdup(ptr->indicator->type->type_name), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_struct_type(ptr->indicator->type->u.members, ptr->indicator->type->type, ptr->indicator->type->type_name, ptr->indicator->type->struct_sizeof), 0);
! sprintf(temp, "%d, &(", ecpg_informix_var++);
! }
! else if (ptr->indicator->type->type == ECPGt_array)
! {
! if (ptr->indicator->type->u.element->type == ECPGt_struct || ptr->indicator->type->u.element->type == ECPGt_union)
! {
! sprintf(temp, "%d)))", ecpg_informix_var);
! newind = new_variable(cat_str(4, make_str("(*("), mm_strdup(ptr->indicator->type->u.element->type_name), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_struct_type(ptr->indicator->type->u.element->u.members, ptr->indicator->type->u.element->type, ptr->indicator->type->u.element->type_name, ptr->indicator->type->u.element->struct_sizeof), 0);
! sprintf(temp, "%d, (", ecpg_informix_var++);
! }
! else
! {
! newind = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->indicator->type->u.element->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->indicator->type->u.element->type, ptr->indicator->type->u.element->size, ptr->indicator->type->u.element->lineno), ptr->indicator->type->size), 0);
! sprintf(temp, "%d, &(", ecpg_informix_var++);
! }
! }
! else if (atoi(ptr->indicator->type->size) > 1)
! {
! newind = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->lineno), 0);
sprintf(temp, "%d, (", ecpg_informix_var++);
}
else
{
! newind = new_variable(cat_str(4, make_str("*("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->lineno), 0);
sprintf(temp, "%d, &(", ecpg_informix_var++);
}
result = cat_str(5, result, make_str("ECPG_informix_set_var("), mm_strdup(temp), mm_strdup(original_var), make_str("), __LINE__);\n"));
}
+
+ add_variable_to_tail(&newlist, newvar, newind);
}
+ if (insert)
+ cur->argsinsert_oos = newlist;
+ else
+ cur->argsresult_oos = newlist;
+
return result;
}
+ /* This tests whether the cursor was declared and opened in the same function. */
+ #define SAMEFUNC(cur) \
+ ((cur->function == NULL) || \
+ (cur->function != NULL && !strcmp(cur->function, current_function)))
+
static struct cursor *
add_additional_variables(char *name, bool insert)
{
*************** add_additional_variables(char *name, boo
*** 318,329 ****
{
/* add all those input variables that were given earlier
* note that we have to append here but have to keep the existing order */
! for (p = ptr->argsinsert; p; p = p->next)
add_variable_to_tail(&argsinsert, p->variable, p->indicator);
}
/* add all those output variables that were given earlier */
! for (p = ptr->argsresult; p; p = p->next)
add_variable_to_tail(&argsresult, p->variable, p->indicator);
return ptr;
--- 396,407 ----
{
/* add all those input variables that were given earlier
* note that we have to append here but have to keep the existing order */
! for (p = ((!INFORMIX_MODE || SAMEFUNC(ptr)) ? ptr->argsinsert : ptr->argsinsert_oos); p; p = p->next)
add_variable_to_tail(&argsinsert, p->variable, p->indicator);
}
/* add all those output variables that were given earlier */
! for (p = ((!INFORMIX_MODE || SAMEFUNC(ptr)) ? ptr->argsresult : ptr->argsresult_oos); p; p = p->next)
add_variable_to_tail(&argsresult, p->variable, p->indicator);
return ptr;
diff -dcrpN pgsql.3/src/interfaces/ecpg/preproc/ecpg.trailer pgsql.4/src/interfaces/ecpg/preproc/ecpg.trailer
*** pgsql.3/src/interfaces/ecpg/preproc/ecpg.trailer 2009-11-16 11:33:34.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/preproc/ecpg.trailer 2009-11-16 11:35:10.000000000 +0100
*************** statement: ecpgstart at stmt ';'
*** 16,22 ****
| c_thing { fprintf(yyout, "%s", $1); free($1); }
| CPP_LINE { fprintf(yyout, "%s", $1); free($1); }
| '{' { braces_open++; fputs("{", yyout); }
! | '}' { remove_typedefs(braces_open); remove_variables(braces_open--); fputs("}", yyout); }
;
CreateAsStmt: CREATE OptTemp TABLE create_as_target AS {FoundInto = 0;} SelectStmt opt_with_data
--- 16,32 ----
| c_thing { fprintf(yyout, "%s", $1); free($1); }
| CPP_LINE { fprintf(yyout, "%s", $1); free($1); }
| '{' { braces_open++; fputs("{", yyout); }
! | '}'
! {
! remove_typedefs(braces_open);
! remove_variables(braces_open--);
! if (braces_open == 0)
! {
! free(current_function);
! current_function = NULL;
! }
! fputs("}", yyout);
! }
;
CreateAsStmt: CREATE OptTemp TABLE create_as_target AS {FoundInto = 0;} SelectStmt opt_with_data
*************** ECPGCursorStmt: DECLARE cursor_name cur
*** 313,318 ****
--- 323,329 ----
char *cursor_marker = $2[0] == ':' ? make_str("$0") : mm_strdup($2);
struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
const char *con = connection ? connection : "NULL";
+ char *comment;
for (ptr = cur; ptr != NULL; ptr = ptr->next)
{
*************** ECPGCursorStmt: DECLARE cursor_name cur
*** 326,334 ****
--- 337,347 ----
/* initial definition */
this->next = cur;
this->name = $2;
+ this->function = (current_function ? mm_strdup(current_function) : NULL);
this->connection = connection;
this->command = cat_str(6, make_str("declare"), cursor_marker, $3, make_str("cursor"), $5, make_str("for $1"));
this->argsresult = NULL;
+ this->argsresult_oos = NULL;
thisquery->type = &ecpg_query;
thisquery->brace_level = 0;
*************** ECPGCursorStmt: DECLARE cursor_name cur
*** 337,342 ****
--- 350,356 ----
sprintf(thisquery->name, "ECPGprepared_statement(%s, %s, __LINE__)", con, $7);
this->argsinsert = NULL;
+ this->argsinsert_oos = NULL;
if ($2[0] == ':')
{
struct variable *var = find_variable($2 + 1);
*************** ECPGCursorStmt: DECLARE cursor_name cur
*** 347,356 ****
cur = this;
! if (INFORMIX_MODE && braces_open > 0) /* we're in a function */
! $$ = cat_str(4, make_str("ECPG_informix_reset_sqlca();"), make_str("/*"), mm_strdup(this->command), make_str("*/"));
else
! $$ = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/"));
}
;
--- 361,377 ----
cur = this;
! comment = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/"));
!
! if (INFORMIX_MODE)
! {
! if (braces_open > 0) /* we're in a function */
! $$ = cat_str(4, adjust_informix(this, true), adjust_informix(this, false), make_str("ECPG_informix_reset_sqlca();"), comment);
! else
! $$ = cat_str(3, adjust_informix(this, true), adjust_informix(this, false), comment);
! }
else
! $$ = comment;
}
;
*************** var_declaration: storage_declaration
*** 434,439 ****
--- 455,461 ----
var_type
{
actual_type[struct_level].type_enum = $2.type_enum;
+ actual_type[struct_level].type_str = $2.type_str;
actual_type[struct_level].type_dimension = $2.type_dimension;
actual_type[struct_level].type_index = $2.type_index;
actual_type[struct_level].type_sizeof = $2.type_sizeof;
*************** var_declaration: storage_declaration
*** 447,452 ****
--- 469,475 ----
| var_type
{
actual_type[struct_level].type_enum = $1.type_enum;
+ actual_type[struct_level].type_str = $1.type_str;
actual_type[struct_level].type_dimension = $1.type_dimension;
actual_type[struct_level].type_index = $1.type_index;
actual_type[struct_level].type_sizeof = $1.type_sizeof;
*************** variable: opt_pointer ECPGColLabel opt_a
*** 858,866 ****
case ECPGt_struct:
case ECPGt_union:
if (atoi(dimension) < 0)
! type = ECPGmake_struct_type(struct_member_list[struct_level], actual_type[struct_level].type_enum, actual_type[struct_level].type_sizeof);
else
! type = ECPGmake_array_type(ECPGmake_struct_type(struct_member_list[struct_level], actual_type[struct_level].type_enum, actual_type[struct_level].type_sizeof), dimension);
$$ = cat_str(5, $1, mm_strdup($2), $3.str, $4, $5);
break;
--- 881,889 ----
case ECPGt_struct:
case ECPGt_union:
if (atoi(dimension) < 0)
! type = ECPGmake_struct_type(struct_member_list[struct_level], actual_type[struct_level].type_enum, actual_type[struct_level].type_str, actual_type[struct_level].type_sizeof);
else
! type = ECPGmake_array_type(ECPGmake_struct_type(struct_member_list[struct_level], actual_type[struct_level].type_enum, actual_type[struct_level].type_str, actual_type[struct_level].type_sizeof), dimension);
$$ = cat_str(5, $1, mm_strdup($2), $3.str, $4, $5);
break;
*************** ECPGVar: SQL_VAR
*** 1364,1372 ****
case ECPGt_struct:
case ECPGt_union:
if (atoi(dimension) < 0)
! type = ECPGmake_struct_type(struct_member_list[struct_level], $5.type_enum, $5.type_sizeof);
else
! type = ECPGmake_array_type(ECPGmake_struct_type(struct_member_list[struct_level], $5.type_enum,$5.type_sizeof), dimension);
break;
case ECPGt_varchar:
--- 1387,1395 ----
case ECPGt_struct:
case ECPGt_union:
if (atoi(dimension) < 0)
! type = ECPGmake_struct_type(struct_member_list[struct_level], $5.type_enum, $5.type_str, $5.type_sizeof);
else
! type = ECPGmake_array_type(ECPGmake_struct_type(struct_member_list[struct_level], $5.type_enum, $5.type_str, $5.type_sizeof), dimension);
break;
case ECPGt_varchar:
diff -dcrpN pgsql.3/src/interfaces/ecpg/preproc/extern.h pgsql.4/src/interfaces/ecpg/preproc/extern.h
*** pgsql.3/src/interfaces/ecpg/preproc/extern.h 2009-11-16 11:07:02.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/preproc/extern.h 2009-11-16 11:35:10.000000000 +0100
*************** extern int braces_open,
*** 29,34 ****
--- 29,35 ----
ecpg_informix_var,
regression_mode,
auto_prepare;
+ extern char *current_function;
extern char *descriptor_index;
extern char *descriptor_name;
extern char *connection;
diff -dcrpN pgsql.3/src/interfaces/ecpg/preproc/pgc.l pgsql.4/src/interfaces/ecpg/preproc/pgc.l
*** pgsql.3/src/interfaces/ecpg/preproc/pgc.l 2009-09-18 08:26:55.000000000 +0200
--- pgsql.4/src/interfaces/ecpg/preproc/pgc.l 2009-11-16 11:35:10.000000000 +0100
*************** static char *literalbuf = NULL; /* e
*** 41,46 ****
--- 41,49 ----
static int literallen; /* actual current length */
static int literalalloc; /* current allocated buffer size */
+ /* Used for detecting global state together with braces_open */
+ static int parenths_open;
+
#define startlit() (literalbuf[0] = '\0', literallen = 0)
static void addlit(char *ytext, int yleng);
static void addlitchar (unsigned char);
*************** cppline {space}*#(.*\\{space})*.*{newl
*** 788,794 ****
}
<C>{identifier} {
const ScanKeyword *keyword;
!
/* Informix uses SQL defines only in SQL space */
/* however, some defines have to be taken care of for compatibility */
if ((!INFORMIX_MODE || !isinformixdefine()) && !isdefine())
--- 791,807 ----
}
<C>{identifier} {
const ScanKeyword *keyword;
!
! /*
! * Try to detect a function name:
! * look for identifiers at the global scope
! * keep the last identifier before the first '(' and '{' */
! if (braces_open == 0 && parenths_open == 0)
! {
! if (current_function)
! free(current_function);
! current_function = mm_strdup(yytext);
! }
/* Informix uses SQL defines only in SQL space */
/* however, some defines have to be taken care of for compatibility */
if ((!INFORMIX_MODE || !isinformixdefine()) && !isdefine())
*************** cppline {space}*#(.*\\{space})*.*{newl
*** 811,818 ****
<C>"/" { return('/'); }
<C>"+" { return('+'); }
<C>"-" { return('-'); }
! <C>"(" { return('('); }
! <C>")" { return(')'); }
<C,xskip>{space} { ECHO; }
<C>\{ { return('{'); }
<C>\} { return('}'); }
--- 824,831 ----
<C>"/" { return('/'); }
<C>"+" { return('+'); }
<C>"-" { return('-'); }
! <C>"(" { parenths_open++; return('('); }
! <C>")" { parenths_open--; return(')'); }
<C,xskip>{space} { ECHO; }
<C>\{ { return('{'); }
<C>\} { return('}'); }
*************** void
*** 1178,1183 ****
--- 1191,1198 ----
lex_init(void)
{
braces_open = 0;
+ parenths_open = 0;
+ current_function = NULL;
preproc_tos = 0;
yylineno = 1;
diff -dcrpN pgsql.3/src/interfaces/ecpg/preproc/type.c pgsql.4/src/interfaces/ecpg/preproc/type.c
*** pgsql.3/src/interfaces/ecpg/preproc/type.c 2009-11-16 11:07:02.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/preproc/type.c 2009-11-16 11:35:10.000000000 +0100
*************** ECPGstruct_member_dup(struct ECPGstruct_
*** 46,52 ****
{
case ECPGt_struct:
case ECPGt_union:
! type = ECPGmake_struct_type(rm->type->u.members, rm->type->type, rm->type->struct_sizeof);
break;
case ECPGt_array:
--- 46,52 ----
{
case ECPGt_struct:
case ECPGt_union:
! type = ECPGmake_struct_type(rm->type->u.members, rm->type->type, rm->type->type_name, rm->type->struct_sizeof);
break;
case ECPGt_array:
*************** ECPGstruct_member_dup(struct ECPGstruct_
*** 55,61 ****
* create the struct too
*/
if (rm->type->u.element->type == ECPGt_struct)
! type = ECPGmake_struct_type(rm->type->u.element->u.members, rm->type->u.element->type, rm->type->u.element->struct_sizeof);
else
type = ECPGmake_array_type(ECPGmake_simple_type(rm->type->u.element->type, rm->type->u.element->size, rm->type->u.element->lineno), rm->type->size);
break;
--- 55,61 ----
* create the struct too
*/
if (rm->type->u.element->type == ECPGt_struct)
! type = ECPGmake_struct_type(rm->type->u.element->u.members, rm->type->u.element->type, rm->type->u.element->type_name, rm->type->u.element->struct_sizeof);
else
type = ECPGmake_array_type(ECPGmake_simple_type(rm->type->u.element->type, rm->type->u.element->size, rm->type->u.element->lineno), rm->type->size);
break;
*************** ECPGmake_simple_type(enum ECPGttype type
*** 98,103 ****
--- 98,104 ----
struct ECPGtype *ne = (struct ECPGtype *) mm_alloc(sizeof(struct ECPGtype));
ne->type = type;
+ ne->type_name = NULL;
ne->size = size;
ne->u.element = NULL;
ne->struct_sizeof = NULL;
*************** ECPGmake_array_type(struct ECPGtype * ty
*** 117,126 ****
}
struct ECPGtype *
! ECPGmake_struct_type(struct ECPGstruct_member * rm, enum ECPGttype type, char *struct_sizeof)
{
struct ECPGtype *ne = ECPGmake_simple_type(type, make_str("1"), 0);
ne->u.members = ECPGstruct_member_dup(rm);
ne->struct_sizeof = struct_sizeof;
--- 118,128 ----
}
struct ECPGtype *
! ECPGmake_struct_type(struct ECPGstruct_member * rm, enum ECPGttype type, char *type_name, char *struct_sizeof)
{
struct ECPGtype *ne = ECPGmake_simple_type(type, make_str("1"), 0);
+ ne->type_name = mm_strdup(type_name);
ne->u.members = ECPGstruct_member_dup(rm);
ne->struct_sizeof = struct_sizeof;
diff -dcrpN pgsql.3/src/interfaces/ecpg/preproc/type.h pgsql.4/src/interfaces/ecpg/preproc/type.h
*** pgsql.3/src/interfaces/ecpg/preproc/type.h 2009-06-13 18:25:05.000000000 +0200
--- pgsql.4/src/interfaces/ecpg/preproc/type.h 2009-11-16 11:35:10.000000000 +0100
*************** struct ECPGstruct_member
*** 17,22 ****
--- 17,23 ----
struct ECPGtype
{
enum ECPGttype type;
+ char *type_name; /* For struct and union types it is the struct name */
char *size; /* For array it is the number of elements. For
* varchar it is the maxsize of the area. */
char *struct_sizeof; /* For a struct this is the sizeof() type as
*************** void ECPGmake_struct_member(char *, str
*** 36,42 ****
struct ECPGtype *ECPGmake_simple_type(enum ECPGttype, char *, int);
struct ECPGtype *ECPGmake_varchar_type(enum ECPGttype, long);
struct ECPGtype *ECPGmake_array_type(struct ECPGtype *, char *);
! struct ECPGtype *ECPGmake_struct_type(struct ECPGstruct_member *, enum ECPGttype, char *);
struct ECPGstruct_member *ECPGstruct_member_dup(struct ECPGstruct_member *);
/* Frees a type. */
--- 37,43 ----
struct ECPGtype *ECPGmake_simple_type(enum ECPGttype, char *, int);
struct ECPGtype *ECPGmake_varchar_type(enum ECPGttype, long);
struct ECPGtype *ECPGmake_array_type(struct ECPGtype *, char *);
! struct ECPGtype *ECPGmake_struct_type(struct ECPGstruct_member *, enum ECPGttype, char *, char *);
struct ECPGstruct_member *ECPGstruct_member_dup(struct ECPGstruct_member *);
/* Frees a type. */
*************** struct _include_path
*** 123,133 ****
--- 124,137 ----
struct cursor
{
char *name;
+ char *function;
char *command;
char *connection;
bool opened;
struct arguments *argsinsert;
+ struct arguments *argsinsert_oos;
struct arguments *argsresult;
+ struct arguments *argsresult_oos;
struct cursor *next;
};
diff -dcrpN pgsql.3/src/interfaces/ecpg/preproc/variable.c pgsql.4/src/interfaces/ecpg/preproc/variable.c
*** pgsql.3/src/interfaces/ecpg/preproc/variable.c 2009-11-16 10:44:18.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/preproc/variable.c 2009-11-16 11:35:10.000000000 +0100
*************** find_struct_member(char *name, char *str
*** 47,53 ****
return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->lineno), members->type->size), brace_level));
case ECPGt_struct:
case ECPGt_union:
! return (new_variable(name, ECPGmake_struct_type(members->type->u.members, members->type->type, members->type->struct_sizeof), brace_level));
default:
return (new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size, members->type->lineno), brace_level));
}
--- 47,53 ----
return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->lineno), members->type->size), brace_level));
case ECPGt_struct:
case ECPGt_union:
! return (new_variable(name, ECPGmake_struct_type(members->type->u.members, members->type->type, members->type->type_name, members->type->struct_sizeof), brace_level));
default:
return (new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size, members->type->lineno), brace_level));
}
*************** find_struct_member(char *name, char *str
*** 94,100 ****
return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->u.element->type, members->type->u.element->u.element->size, members->type->u.element->u.element->lineno), members->type->u.element->size), brace_level));
case ECPGt_struct:
case ECPGt_union:
! return (new_variable(name, ECPGmake_struct_type(members->type->u.element->u.members, members->type->u.element->type, members->type->u.element->struct_sizeof), brace_level));
default:
return (new_variable(name, ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->lineno), brace_level));
}
--- 94,100 ----
return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->u.element->type, members->type->u.element->u.element->size, members->type->u.element->u.element->lineno), members->type->u.element->size), brace_level));
case ECPGt_struct:
case ECPGt_union:
! return (new_variable(name, ECPGmake_struct_type(members->type->u.element->u.members, members->type->u.element->type, members->type->u.element->type_name, members->type->u.element->struct_sizeof), brace_level));
default:
return (new_variable(name, ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->lineno), brace_level));
}
*************** find_variable(char *name)
*** 235,241 ****
return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(p->type->u.element->u.element->type, p->type->u.element->u.element->size, p->type->u.element->u.element->lineno), p->type->u.element->size), p->brace_level));
case ECPGt_struct:
case ECPGt_union:
! return (new_variable(name, ECPGmake_struct_type(p->type->u.element->u.members, p->type->u.element->type, p->type->u.element->struct_sizeof), p->brace_level));
default:
return (new_variable(name, ECPGmake_simple_type(p->type->u.element->type, p->type->u.element->size, p->type->u.element->lineno), p->brace_level));
}
--- 235,241 ----
return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(p->type->u.element->u.element->type, p->type->u.element->u.element->size, p->type->u.element->u.element->lineno), p->type->u.element->size), p->brace_level));
case ECPGt_struct:
case ECPGt_union:
! return (new_variable(name, ECPGmake_struct_type(p->type->u.element->u.members, p->type->u.element->type, p->type->u.element->type_name, p->type->u.element->struct_sizeof), p->brace_level));
default:
return (new_variable(name, ECPGmake_simple_type(p->type->u.element->type, p->type->u.element->size, p->type->u.element->lineno), p->brace_level));
}
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/compat_informix/Makefile pgsql.4/src/interfaces/ecpg/test/compat_informix/Makefile
*** pgsql.3/src/interfaces/ecpg/test/compat_informix/Makefile 2009-11-16 11:24:24.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/compat_informix/Makefile 2009-11-16 11:35:10.000000000 +0100
*************** TESTS = test_informix test_informix.c \
*** 14,19 ****
--- 14,21 ----
test_informix2 test_informix2.c \
cursor cursor.c \
describe describe.c \
+ struct struct.c \
+ outofscope outofscope.c \
dec_test dec_test.c \
rfmtdate rfmtdate.c \
rfmtlong rfmtlong.c \
*************** describe.c: describe.pgc ../regression.h
*** 38,43 ****
--- 40,51 ----
sqlda.c: sqlda.pgc ../regression.h
$(ECPG) -o $@ -I$(srcdir) $<
+ struct.c: struct.pgc ../regression.h
+ $(ECPG) -o $@ -I$(srcdir) $<
+
+ outofscope.c: outofscope.pgc ../regression.h
+ $(ECPG) -o $@ -I$(srcdir) $<
+
dec_test.c: dec_test.pgc ../regression.h
$(ECPG) -o $@ -I$(srcdir) $<
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/compat_informix/outofscope.pgc pgsql.4/src/interfaces/ecpg/test/compat_informix/outofscope.pgc
*** pgsql.3/src/interfaces/ecpg/test/compat_informix/outofscope.pgc 1970-01-01 01:00:00.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/compat_informix/outofscope.pgc 2009-11-16 11:35:10.000000000 +0100
***************
*** 0 ****
--- 1,256 ----
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <inttypes.h>
+
+ exec sql include ../regression;
+
+ exec sql include sqlda.h;
+ exec sql include sqltypes.h;
+
+ exec sql begin declare section;
+ exec sql include struct.h;
+ exec sql end declare section;
+
+ exec sql whenever sqlerror stop;
+
+ /* Functions for test 1 */
+
+ static void
+ get_var1(MYTYPE **myvar0, MYNULLTYPE **mynullvar0)
+ {
+ exec sql begin declare section;
+ MYTYPE *myvar = malloc(sizeof(MYTYPE));
+ MYNULLTYPE *mynullvar = malloc(sizeof(MYNULLTYPE));
+ exec sql end declare section;
+
+ /* Test DECLARE ... SELECT ... INTO with pointers */
+
+ exec sql declare mycur cursor for select * INTO :myvar :mynullvar from a1;
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+
+ *myvar0 = myvar;
+ *mynullvar0 = mynullvar;
+ }
+
+ static void
+ open_cur1(void)
+ {
+ exec sql open mycur;
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+ }
+
+ static void
+ get_record1(void)
+ {
+ exec sql fetch mycur;
+
+ if (sqlca.sqlcode != 0 && sqlca.sqlcode != SQLNOTFOUND)
+ exit(1);
+ }
+
+ static void
+ close_cur1(void)
+ {
+ exec sql close mycur;
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+ }
+
+ /* Functions for test 2 */
+
+ pg_sqlda_t *inp_sqlda, *outp_sqlda;
+
+ exec sql begin declare section;
+ char *stmt2 = "SELECT * FROM a1 WHERE id = ?";
+ char *curname2 = "mycur";
+ int id;
+ exec sql end declare section;
+
+ static void
+ prepare2(void)
+ {
+ exec sql prepare prepared_stmt from :stmt2;
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+
+ inp_sqlda = (pg_sqlda_t *)malloc(sizeof(pg_sqlda_t));
+ memset(inp_sqlda, 0, sizeof(pg_sqlda_t));
+ inp_sqlda->sqld = 1;
+ inp_sqlda->sqlvar = malloc(sizeof(pg_sqlvar_t));
+ memset(inp_sqlda->sqlvar, 0, sizeof(pg_sqlvar_t));
+
+ inp_sqlda->sqlvar[0].sqltype = SQLINT;
+ inp_sqlda->sqlvar[0].sqldata = (char *)&id;
+ id = 4;
+ }
+
+ static void
+ declare2(void)
+ {
+ exec sql declare :curname2 cursor for prepared_stmt;
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+ }
+
+ static void
+ dealloc_prep2(void)
+ {
+ exec sql deallocate prepare prepared_stmt;
+
+ free(inp_sqlda->sqlvar);
+ free(inp_sqlda);
+ free(outp_sqlda);
+ }
+
+ static void
+ open_cur2(void)
+ {
+ exec sql open :curname2 using descriptor inp_sqlda;
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+ }
+
+ static void
+ close_cur2(void)
+ {
+ exec sql close :curname2;
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+ }
+
+ static void
+ get_record2(void)
+ {
+ exec sql fetch :curname2 into descriptor outp_sqlda;
+
+ if (sqlca.sqlcode != 0 && sqlca.sqlcode != SQLNOTFOUND)
+ exit(1);
+ }
+
+ static void
+ dump_sqlda(pg_sqlda_t *sqlda)
+ {
+ int i;
+
+ for (i = 0; i < sqlda->sqld; i++)
+ {
+ if (outp_sqlda->sqlvar[i].sqlind && *(outp_sqlda->sqlvar[i].sqlind) == -1)
+ printf("name sqlda descriptor: '%s' value NULL'\n", outp_sqlda->sqlvar[i].sqlname);
+ else
+ switch (sqlda->sqlvar[i].sqltype)
+ {
+ case SQLCHAR:
+ case SQLVCHAR:
+ case SQLTEXT:
+ printf("name sqlda descriptor: '%s' value '%s'\n", sqlda->sqlvar[i].sqlname, sqlda->sqlvar[i].sqldata);
+ break;
+ case SQLSERIAL:
+ case SQLINT:
+ printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata);
+ break;
+ case SQLSERIAL8:
+ case SQLINT8:
+ printf("name sqlda descriptor: '%s' value %" PRId64 "\n", sqlda->sqlvar[i].sqlname, *(int64_t *)sqlda->sqlvar[i].sqldata);
+ break;
+ case SQLFLOAT:
+ printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
+ break;
+ case SQLDECIMAL:
+ {
+ char val[64];
+ dectoasc((dec_t *)sqlda->sqlvar[i].sqldata, val, 64, -1);
+ printf("name sqlda descriptor: '%s' value DECIMAL '%s'\n", sqlda->sqlvar[i].sqlname, val);
+ break;
+ }
+ }
+ }
+ }
+
+ int
+ main (void)
+ {
+ MYTYPE *myvar;
+ MYNULLTYPE *mynullvar;
+
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ exec sql connect to REGRESSDB1;
+
+ strcpy(msg, "set");
+ exec sql set datestyle to iso;
+
+ strcpy(msg, "create");
+ exec sql create table a1(id serial primary key, t text, d1 numeric, d2 float8, c character(10));
+
+ strcpy(msg, "insert");
+ exec sql insert into a1(id, t, d1, d2, c) values (default, 'a', 1.0, 2, 'a');
+ exec sql insert into a1(id, t, d1, d2, c) values (default, null, null, null, null);
+ exec sql insert into a1(id, t, d1, d2, c) values (default, '"a"', -1.0, 'nan'::float8, 'a');
+ exec sql insert into a1(id, t, d1, d2, c) values (default, 'b', 2.0, 3, 'b');
+
+ strcpy(msg, "commit");
+ exec sql commit;
+
+ /* Test out-of-scope DECLARE/OPEN/FETCH/CLOSE */
+
+ get_var1(&myvar, &mynullvar);
+ open_cur1();
+
+ exec sql whenever not found do break;
+
+ while (1)
+ {
+ memset(myvar, 0, sizeof(MYTYPE));
+ get_record1();
+ if (sqlca.sqlcode == SQLNOTFOUND)
+ break;
+ printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s\n",
+ myvar->id, mynullvar->id ? " (NULL)" : "",
+ myvar->t, mynullvar->t ? " (NULL)" : "",
+ myvar->d1, mynullvar->d1 ? " (NULL)" : "",
+ myvar->d2, mynullvar->d2 ? " (NULL)" : "",
+ myvar->c, mynullvar->c ? " (NULL)" : "");
+ }
+
+ close_cur1();
+
+ /* Test out-of-scope DECLARE/OPEN/FETCH/CLOSE interaction
+ * with a dynamic cursor and prepared statment using an sqlda
+ */
+
+ prepare2();
+ declare2();
+ open_cur2();
+
+ get_record2();
+ dump_sqlda(outp_sqlda);
+
+ close_cur2();
+ dealloc_prep2();
+
+ /* End test */
+
+ strcpy(msg, "drop");
+ exec sql drop table a1;
+
+ strcpy(msg, "commit");
+ exec sql commit;
+
+ strcpy(msg, "disconnect");
+ exec sql disconnect;
+
+ return (0);
+ }
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/compat_informix/struct.h pgsql.4/src/interfaces/ecpg/test/compat_informix/struct.h
*** pgsql.3/src/interfaces/ecpg/test/compat_informix/struct.h 1970-01-01 01:00:00.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/compat_informix/struct.h 2009-11-16 11:35:10.000000000 +0100
***************
*** 0 ****
--- 1,18 ----
+
+ struct mytype {
+ int id;
+ char t[64];
+ double d1; /* dec_t */
+ double d2;
+ char c[30];
+ };
+ typedef struct mytype MYTYPE;
+
+ struct mynulltype {
+ int id;
+ int t;
+ int d1;
+ int d2;
+ int c;
+ };
+ typedef struct mynulltype MYNULLTYPE;
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/compat_informix/struct.pgc pgsql.4/src/interfaces/ecpg/test/compat_informix/struct.pgc
*** pgsql.3/src/interfaces/ecpg/test/compat_informix/struct.pgc 1970-01-01 01:00:00.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/compat_informix/struct.pgc 2009-11-16 11:35:10.000000000 +0100
***************
*** 0 ****
--- 1,76 ----
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+
+ exec sql include ../regression;
+
+ exec sql begin declare section;
+ exec sql include struct.h;
+ exec sql end declare section;
+
+ exec sql whenever sqlerror stop;
+
+ int
+ main (void)
+ {
+ exec sql begin declare section;
+ MYTYPE myvar;
+ MYNULLTYPE mynullvar;
+ exec sql end declare section;
+
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ exec sql connect to REGRESSDB1;
+
+ strcpy(msg, "set");
+ exec sql set datestyle to iso;
+
+ strcpy(msg, "create");
+ exec sql create table a1(id serial primary key, t text, d1 numeric, d2 float8, c character(10));
+
+ strcpy(msg, "insert");
+ exec sql insert into a1(id, t, d1, d2, c) values (default, 'a', 1.0, 2, 'a');
+ exec sql insert into a1(id, t, d1, d2, c) values (default, null, null, null, null);
+ exec sql insert into a1(id, t, d1, d2, c) values (default, '"a"', -1.0, 'nan'::float8, 'a');
+ exec sql insert into a1(id, t, d1, d2, c) values (default, 'b', 2.0, 3, 'b');
+
+ strcpy(msg, "commit");
+ exec sql commit;
+
+ /* Test DECLARE ... SELECT ... INTO with struct type */
+
+ exec sql declare mycur cursor for select * into :myvar :mynullvar from a1;
+ exec sql open mycur;
+
+ exec sql whenever not found do break;
+
+ while (1)
+ {
+ memset(&myvar, 0, sizeof(myvar));
+ exec sql fetch mycur;
+ printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s\n",
+ myvar.id, mynullvar.id ? " (NULL)" : "",
+ myvar.t, mynullvar.t ? " (NULL)" : "",
+ myvar.d1, mynullvar.d1 ? " (NULL)" : "",
+ myvar.d2, mynullvar.d2 ? " (NULL)" : "",
+ myvar.c, mynullvar.c ? " (NULL)" : "");
+ }
+
+ exec sql close mycur;
+
+ /* End test */
+
+ strcpy(msg, "drop");
+ exec sql drop table a1;
+
+ strcpy(msg, "commit");
+ exec sql commit;
+
+ strcpy(msg, "disconnect");
+ exec sql disconnect;
+
+ return (0);
+ }
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/ecpg_schedule pgsql.4/src/interfaces/ecpg/test/ecpg_schedule
*** pgsql.3/src/interfaces/ecpg/test/ecpg_schedule 2009-11-16 11:24:24.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/ecpg_schedule 2009-11-16 11:35:10.000000000 +0100
*************** test: compat_informix/rnull
*** 6,11 ****
--- 6,13 ----
test: compat_informix/cursor
test: compat_informix/sqlda
test: compat_informix/describe
+ test: compat_informix/struct
+ test: compat_informix/outofscope
test: compat_informix/test_informix
test: compat_informix/test_informix2
test: connect/test2
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/ecpg_schedule_tcp pgsql.4/src/interfaces/ecpg/test/ecpg_schedule_tcp
*** pgsql.3/src/interfaces/ecpg/test/ecpg_schedule_tcp 2009-11-16 11:24:24.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/ecpg_schedule_tcp 2009-11-16 11:35:10.000000000 +0100
*************** test: compat_informix/rnull
*** 6,11 ****
--- 6,13 ----
test: compat_informix/cursor
test: compat_informix/sqlda
test: compat_informix/describe
+ test: compat_informix/struct
+ test: compat_informix/outofscope
test: compat_informix/test_informix
test: compat_informix/test_informix2
test: connect/test2
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-cursor.c pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-cursor.c
*** pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-cursor.c 2009-11-16 10:52:22.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-cursor.c 2009-11-16 11:35:10.000000000 +0100
*************** if (sqlca.sqlcode < 0) exit (1);}
*** 162,168 ****
strcpy(msg, "open");
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare $0 cursor for select id , t from t1",
! ECPGt_char,&(*( char *)(ECPG_informix_get_var( 0))),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 62 "cursor.pgc"
--- 162,168 ----
strcpy(msg, "open");
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare $0 cursor for select id , t from t1",
! ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 62 "cursor.pgc"
*************** if (sqlca.sqlcode < 0) exit (1);}
*** 298,308 ****
strcpy(msg, "open");
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare $0 cursor for select id , t from t1",
! ECPGt_char,&(*( char *)(ECPG_informix_get_var( 3))),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(*( int *)(ECPG_informix_get_var( 2))),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(( char *)(ECPG_informix_get_var( 1))),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 103 "cursor.pgc"
--- 298,308 ----
strcpy(msg, "open");
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare $0 cursor for select id , t from t1",
! ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 103 "cursor.pgc"
*************** if (sqlca.sqlcode < 0) exit (1);}
*** 314,322 ****
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch from $0",
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(*( int *)(ECPG_informix_get_var( 2))),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(( char *)(ECPG_informix_get_var( 1))),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 106 "cursor.pgc"
--- 314,322 ----
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch from $0",
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 106 "cursor.pgc"
*************** if (sqlca.sqlcode < 0) exit (1);}
*** 329,337 ****
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0",
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(*( int *)(ECPG_informix_get_var( 2))),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(( char *)(ECPG_informix_get_var( 1))),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 110 "cursor.pgc"
--- 329,337 ----
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0",
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 110 "cursor.pgc"
*************** if (sqlca.sqlcode < 0) exit (1);}
*** 344,352 ****
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch 1 from $0",
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(*( int *)(ECPG_informix_get_var( 2))),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(( char *)(ECPG_informix_get_var( 1))),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 114 "cursor.pgc"
--- 344,352 ----
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch 1 from $0",
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 114 "cursor.pgc"
*************** if (sqlca.sqlcode < 0) exit (1);}
*** 362,370 ****
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(*( int *)(ECPG_informix_get_var( 2))),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(( char *)(ECPG_informix_get_var( 1))),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 119 "cursor.pgc"
--- 362,370 ----
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 119 "cursor.pgc"
*************** if (sqlca.sqlcode < 0) exit (1);}
*** 377,385 ****
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "move absolute 0 $0",
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(*( int *)(ECPG_informix_get_var( 2))),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(( char *)(ECPG_informix_get_var( 1))),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 123 "cursor.pgc"
--- 377,385 ----
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "move absolute 0 $0",
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 123 "cursor.pgc"
*************** if (sqlca.sqlcode < 0) exit (1);}
*** 391,399 ****
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch 1 $0",
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(*( int *)(ECPG_informix_get_var( 2))),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(( char *)(ECPG_informix_get_var( 1))),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 126 "cursor.pgc"
--- 391,399 ----
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch 1 $0",
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 126 "cursor.pgc"
*************** if (sqlca.sqlcode < 0) exit (1);}
*** 409,417 ****
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(*( int *)(ECPG_informix_get_var( 2))),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(( char *)(ECPG_informix_get_var( 1))),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 131 "cursor.pgc"
--- 409,417 ----
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
! ECPGt_int,&(id),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
! ECPGt_char,(t),(long)64,(long)1,(64)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 131 "cursor.pgc"
*************** if (sqlca.sqlcode < 0) exit (1);}
*** 441,447 ****
strcpy(msg, "declare");
! ECPG_informix_reset_sqlca(); /* declare $0 cursor for $1 */
#line 143 "cursor.pgc"
--- 441,448 ----
strcpy(msg, "declare");
! ECPG_informix_set_var( 4, &( curname3 ), __LINE__);\
! ECPG_informix_reset_sqlca(); /* declare $0 cursor for $1 */
#line 143 "cursor.pgc"
*************** if (sqlca.sqlcode < 0) exit (1);}
*** 596,602 ****
strcpy(msg, "declare");
! ECPG_informix_reset_sqlca(); /* declare $0 cursor for $1 */
#line 193 "cursor.pgc"
--- 597,604 ----
strcpy(msg, "declare");
! ECPG_informix_set_var( 5, &( curname4 ), __LINE__);\
! ECPG_informix_reset_sqlca(); /* declare $0 cursor for $1 */
#line 193 "cursor.pgc"
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-outofscope.c pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-outofscope.c
*** pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-outofscope.c 1970-01-01 01:00:00.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-outofscope.c 2009-11-16 11:35:10.000000000 +0100
***************
*** 0 ****
--- 1,629 ----
+ /* Processed by ecpg (regression mode) */
+ /* These include files are added by the preprocessor */
+ #include <ecpglib.h>
+ #include <ecpgerrno.h>
+ #include <sqlca.h>
+ /* Needed for informix compatibility */
+ #include <ecpg_informix.h>
+ /* End of automatic include section */
+ #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+ #line 1 "outofscope.pgc"
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <inttypes.h>
+
+
+ #line 1 "regression.h"
+
+
+
+
+
+
+ #line 6 "outofscope.pgc"
+
+
+
+ #line 1 "sqlda.h"
+ /*
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/include/sqlda.h,v 1.4 2009/06/11 14:49:13 momjian Exp $
+ */
+
+ #ifndef POSTGRES_SQLDA_H
+ #define POSTGRES_SQLDA_H
+
+ /* Define Informix "standard" types */
+ #ifndef C_H
+ typedef int int4;
+ typedef short int2;
+ #endif
+ typedef char int1;
+
+ typedef int mint;
+ typedef long mlong;
+
+ typedef short MSHORT;
+ typedef char MCHAR;
+
+ typedef unsigned int uint4;
+ typedef unsigned short uint2;
+ typedef unsigned char uint1;
+
+ typedef unsigned int muint;
+ typedef unsigned long mulong;
+
+ typedef unsigned short MUSHORT;
+ typedef unsigned char MUCHAR;
+
+ #define MI_INT_SIZE (sizeof(int) * 8)
+ #define MI_LONG_SIZE (sizeof(long) * 8)
+ #define MI_PTR_SIZE (sizeof(char *) * 8)
+
+ typedef struct sqlvar_struct
+ {
+ int2 sqltype; /* variable type */
+ int4 sqllen; /* length in bytes */
+ char *sqldata; /* pointer to data */
+ int2 *sqlind; /* pointer to indicator */
+ char *sqlname; /* variable name */
+ char *sqlformat; /* reserved for future use */
+ int2 sqlitype; /* ind variable type */
+ int2 sqlilen; /* ind length in bytes */
+ char *sqlidata; /* ind data pointer */
+ int4 sqlxid; /* extended id type */
+ char *sqltypename; /* extended type name */
+ int2 sqltypelen; /* length of extended type name */
+ int2 sqlownerlen; /* length of owner name */
+ int2 sqlsourcetype; /* source type for distinct of built-ins */
+ char *sqlownername; /* owner name */
+ int4 sqlsourceid; /* extended id of source type */
+
+ /*
+ * sqlilongdata is new. It supports data that exceeds the 32k
+ * limit. sqlilen and sqlidata are for backward compatibility
+ * and they have maximum value of <32K.
+ */
+ char *sqlilongdata; /* for data field beyond 32K */
+ int4 sqlflags; /* for internal use only */
+ void *sqlreserved; /* reserved for future use */
+ } pg_sqlvar_t;
+
+ typedef struct sqlda
+ {
+ int2 sqld;
+ pg_sqlvar_t *sqlvar;
+ char desc_name[19]; /* descriptor name */
+ int2 desc_occ; /* size of sqlda structure */
+ struct sqlda *desc_next; /* pointer to next sqlda struct */
+ void *reserved; /* reserved for future use */
+ } pg_sqlda_t;
+
+ #endif /* POSTGRES_SQLDA_H */
+
+ #line 8 "outofscope.pgc"
+
+
+ #line 1 "sqltypes.h"
+ /*
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/include/sqltypes.h,v 1.9 2009/06/11 14:49:13 momjian Exp $
+ */
+ #ifndef ECPG_SQLTYPES_H
+ #define ECPG_SQLTYPES_H
+
+ #define CCHARTYPE ECPGt_char
+ #define CSHORTTYPE ECPGt_short
+ #define CINTTYPE ECPGt_int
+ #define CLONGTYPE ECPGt_long
+ #define CFLOATTYPE ECPGt_float
+ #define CDOUBLETYPE ECPGt_double
+ #define CDECIMALTYPE ECPGt_decimal
+ #define CFIXCHARTYPE 108
+ #define CSTRINGTYPE ECPGt_char
+ #define CDATETYPE ECPGt_date
+ #define CMONEYTYPE 111
+ #define CDTIMETYPE ECPGt_timestamp
+ #define CLOCATORTYPE 113
+ #define CVCHARTYPE ECPGt_varchar
+ #define CINVTYPE 115
+ #define CFILETYPE 116
+ #define CINT8TYPE ECPGt_long_long
+ #define CCOLLTYPE 118
+ #define CLVCHARTYPE 119
+ #define CFIXBINTYPE 120
+ #define CVARBINTYPE 121
+ #define CBOOLTYPE ECPGt_bool
+ #define CROWTYPE 123
+ #define CLVCHARPTRTYPE 124
+ #define CTYPEMAX 25
+
+ /*
+ * Values used in sqlda->sqlvar[i]->sqltype
+ */
+ #define SQLCHAR 0
+ #define SQLSMINT 1
+ #define SQLINT 2
+ #define SQLFLOAT 3
+ #define SQLSMFLOAT 4
+ #define SQLDECIMAL 5
+ #define SQLSERIAL 6
+ #define SQLDATE 7
+ #define SQLMONEY 8
+ #define SQLDTIME 10
+ #define SQLBYTES 11
+ #define SQLTEXT 12
+ #define SQLVCHAR 13
+ #define SQLINTERVAL 14
+ #define SQLNCHAR 15
+ #define SQLNVCHAR 16
+ #define SQLINT8 17
+ #define SQLSERIAL8 18
+
+ #endif /* ndef ECPG_SQLTYPES_H */
+
+ #line 9 "outofscope.pgc"
+
+
+ /* exec sql begin declare section */
+
+ #line 1 "struct.h"
+
+
+
+
+ /* dec_t */
+
+
+
+ typedef struct mytype MYTYPE ;
+
+ #line 9 "struct.h"
+
+
+
+
+
+
+
+
+
+ typedef struct mynulltype MYNULLTYPE ;
+
+ #line 18 "struct.h"
+
+
+ #line 12 "outofscope.pgc"
+
+ struct mytype {
+ #line 3 "struct.h"
+ int id ;
+
+ #line 4 "struct.h"
+ char t [ 64 ] ;
+
+ #line 5 "struct.h"
+ double d1 ;
+
+ #line 6 "struct.h"
+ double d2 ;
+
+ #line 7 "struct.h"
+ char c [ 30 ] ;
+ } ; struct mynulltype {
+ #line 12 "struct.h"
+ int id ;
+
+ #line 13 "struct.h"
+ int t ;
+
+ #line 14 "struct.h"
+ int d1 ;
+
+ #line 15 "struct.h"
+ int d2 ;
+
+ #line 16 "struct.h"
+ int c ;
+ } ;/* exec sql end declare section */
+ #line 13 "outofscope.pgc"
+
+
+ /* exec sql whenever sqlerror stop ; */
+ #line 15 "outofscope.pgc"
+
+
+ /* Functions for test 1 */
+
+ static void
+ get_var1(MYTYPE **myvar0, MYNULLTYPE **mynullvar0)
+ {
+ /* exec sql begin declare section */
+
+
+
+ #line 23 "outofscope.pgc"
+ MYTYPE * myvar = malloc ( sizeof ( MYTYPE ) ) ;
+
+ #line 24 "outofscope.pgc"
+ MYNULLTYPE * mynullvar = malloc ( sizeof ( MYNULLTYPE ) ) ;
+ /* exec sql end declare section */
+ #line 25 "outofscope.pgc"
+
+
+ /* Test DECLARE ... SELECT ... INTO with pointers */
+
+ ECPG_informix_set_var( 0, ( myvar ), __LINE__);\
+ ECPG_informix_set_var( 1, ( mynullvar ), __LINE__);\
+ ECPG_informix_reset_sqlca(); /* declare mycur cursor for select * from a1 */
+ #line 29 "outofscope.pgc"
+
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+
+ *myvar0 = myvar;
+ *mynullvar0 = mynullvar;
+ }
+
+ static void
+ open_cur1(void)
+ {
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare mycur cursor for select * from a1", ECPGt_EOIT,
+ ECPGt_int,&((*( MYTYPE *)(ECPG_informix_get_var( 0))).id),(long)1,(long)1,sizeof(int),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPG_informix_get_var( 1))).id),(long)1,(long)1,sizeof(int),
+ ECPGt_char,&((*( MYTYPE *)(ECPG_informix_get_var( 0))).t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPG_informix_get_var( 1))).t),(long)1,(long)1,sizeof(int),
+ ECPGt_double,&((*( MYTYPE *)(ECPG_informix_get_var( 0))).d1),(long)1,(long)1,sizeof(double),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPG_informix_get_var( 1))).d1),(long)1,(long)1,sizeof(int),
+ ECPGt_double,&((*( MYTYPE *)(ECPG_informix_get_var( 0))).d2),(long)1,(long)1,sizeof(double),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPG_informix_get_var( 1))).d2),(long)1,(long)1,sizeof(int),
+ ECPGt_char,&((*( MYTYPE *)(ECPG_informix_get_var( 0))).c),(long)30,(long)1,(30)*sizeof(char),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPG_informix_get_var( 1))).c),(long)1,(long)1,sizeof(int), ECPGt_EORT);
+ #line 41 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 41 "outofscope.pgc"
+
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+ }
+
+ static void
+ get_record1(void)
+ {
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch mycur", ECPGt_EOIT,
+ ECPGt_int,&((*( MYTYPE *)(ECPG_informix_get_var( 0))).id),(long)1,(long)1,sizeof(int),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPG_informix_get_var( 1))).id),(long)1,(long)1,sizeof(int),
+ ECPGt_char,&((*( MYTYPE *)(ECPG_informix_get_var( 0))).t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPG_informix_get_var( 1))).t),(long)1,(long)1,sizeof(int),
+ ECPGt_double,&((*( MYTYPE *)(ECPG_informix_get_var( 0))).d1),(long)1,(long)1,sizeof(double),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPG_informix_get_var( 1))).d1),(long)1,(long)1,sizeof(int),
+ ECPGt_double,&((*( MYTYPE *)(ECPG_informix_get_var( 0))).d2),(long)1,(long)1,sizeof(double),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPG_informix_get_var( 1))).d2),(long)1,(long)1,sizeof(int),
+ ECPGt_char,&((*( MYTYPE *)(ECPG_informix_get_var( 0))).c),(long)30,(long)1,(30)*sizeof(char),
+ ECPGt_int,&((*( MYNULLTYPE *)(ECPG_informix_get_var( 1))).c),(long)1,(long)1,sizeof(int), ECPGt_EORT);
+ #line 50 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 50 "outofscope.pgc"
+
+
+ if (sqlca.sqlcode != 0 && sqlca.sqlcode != SQLNOTFOUND)
+ exit(1);
+ }
+
+ static void
+ close_cur1(void)
+ {
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "close mycur", ECPGt_EOIT, ECPGt_EORT);
+ #line 59 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 59 "outofscope.pgc"
+
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+ }
+
+ /* Functions for test 2 */
+
+ pg_sqlda_t *inp_sqlda, *outp_sqlda;
+
+ /* exec sql begin declare section */
+
+
+
+
+ #line 70 "outofscope.pgc"
+ char * stmt2 = "SELECT * FROM a1 WHERE id = ?" ;
+
+ #line 71 "outofscope.pgc"
+ char * curname2 = "mycur" ;
+
+ #line 72 "outofscope.pgc"
+ int id ;
+ /* exec sql end declare section */
+ #line 73 "outofscope.pgc"
+
+
+ static void
+ prepare2(void)
+ {
+ { ECPGprepare(__LINE__, NULL, 0, "prepared_stmt", stmt2);
+ #line 78 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 78 "outofscope.pgc"
+
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+
+ inp_sqlda = (pg_sqlda_t *)malloc(sizeof(pg_sqlda_t));
+ memset(inp_sqlda, 0, sizeof(pg_sqlda_t));
+ inp_sqlda->sqld = 1;
+ inp_sqlda->sqlvar = malloc(sizeof(pg_sqlvar_t));
+ memset(inp_sqlda->sqlvar, 0, sizeof(pg_sqlvar_t));
+
+ inp_sqlda->sqlvar[0].sqltype = SQLINT;
+ inp_sqlda->sqlvar[0].sqldata = (char *)&id;
+ id = 4;
+ }
+
+ static void
+ declare2(void)
+ {
+ ECPG_informix_reset_sqlca(); /* declare $0 cursor for $1 */
+ #line 97 "outofscope.pgc"
+
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+ }
+
+ static void
+ dealloc_prep2(void)
+ {
+ { ECPGdeallocate(__LINE__, 1, NULL, "prepared_stmt");
+ #line 106 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 106 "outofscope.pgc"
+
+
+ free(inp_sqlda->sqlvar);
+ free(inp_sqlda);
+ free(outp_sqlda);
+ }
+
+ static void
+ open_cur2(void)
+ {
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare $0 cursor for $1",
+ ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_char_variable,(ECPGprepared_statement(NULL, "prepared_stmt", __LINE__)),(long)1,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
+ ECPGt_sqlda, & inp_sqlda , 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+ #line 116 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 116 "outofscope.pgc"
+
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+ }
+
+ static void
+ close_cur2(void)
+ {
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "close $0",
+ ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
+ #line 125 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 125 "outofscope.pgc"
+
+
+ if (sqlca.sqlcode != 0)
+ exit(1);
+ }
+
+ static void
+ get_record2(void)
+ {
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0",
+ ECPGt_char,&(curname2),(long)0,(long)1,(1)*sizeof(char),
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
+ ECPGt_sqlda, & outp_sqlda , 0L, 0L, 0L,
+ ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
+ #line 134 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 134 "outofscope.pgc"
+
+
+ if (sqlca.sqlcode != 0 && sqlca.sqlcode != SQLNOTFOUND)
+ exit(1);
+ }
+
+ static void
+ dump_sqlda(pg_sqlda_t *sqlda)
+ {
+ int i;
+
+ for (i = 0; i < sqlda->sqld; i++)
+ {
+ if (outp_sqlda->sqlvar[i].sqlind && *(outp_sqlda->sqlvar[i].sqlind) == -1)
+ printf("name sqlda descriptor: '%s' value NULL'\n", outp_sqlda->sqlvar[i].sqlname);
+ else
+ switch (sqlda->sqlvar[i].sqltype)
+ {
+ case SQLCHAR:
+ case SQLVCHAR:
+ case SQLTEXT:
+ printf("name sqlda descriptor: '%s' value '%s'\n", sqlda->sqlvar[i].sqlname, sqlda->sqlvar[i].sqldata);
+ break;
+ case SQLSERIAL:
+ case SQLINT:
+ printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata);
+ break;
+ case SQLSERIAL8:
+ case SQLINT8:
+ printf("name sqlda descriptor: '%s' value %" PRId64 "\n", sqlda->sqlvar[i].sqlname, *(int64_t *)sqlda->sqlvar[i].sqldata);
+ break;
+ case SQLFLOAT:
+ printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
+ break;
+ case SQLDECIMAL:
+ {
+ char val[64];
+ dectoasc((decimal *)sqlda->sqlvar[i].sqldata, val, 64, -1);
+ printf("name sqlda descriptor: '%s' value DECIMAL '%s'\n", sqlda->sqlvar[i].sqlname, val);
+ break;
+ }
+ }
+ }
+ }
+
+ int
+ main (void)
+ {
+ MYTYPE *myvar;
+ MYNULLTYPE *mynullvar;
+
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 1, "regress1" , NULL, NULL , NULL, 0);
+ #line 190 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 190 "outofscope.pgc"
+
+
+ strcpy(msg, "set");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+ #line 193 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 193 "outofscope.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "create table a1 ( id serial primary key , t text , d1 numeric , d2 float8 , c character ( 10 ) )", ECPGt_EOIT, ECPGt_EORT);
+ #line 196 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 196 "outofscope.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'a' , 1.0 , 2 , 'a' )", ECPGt_EOIT, ECPGt_EORT);
+ #line 199 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 199 "outofscope.pgc"
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , null , null , null , null )", ECPGt_EOIT, ECPGt_EORT);
+ #line 200 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 200 "outofscope.pgc"
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , '\"a\"' , - 1.0 , 'nan' :: float8 , 'a' )", ECPGt_EOIT, ECPGt_EORT);
+ #line 201 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 201 "outofscope.pgc"
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'b' , 2.0 , 3 , 'b' )", ECPGt_EOIT, ECPGt_EORT);
+ #line 202 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 202 "outofscope.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+ #line 205 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 205 "outofscope.pgc"
+
+
+ /* Test out-of-scope DECLARE/OPEN/FETCH/CLOSE */
+
+ get_var1(&myvar, &mynullvar);
+ open_cur1();
+
+ /* exec sql whenever not found break ; */
+ #line 212 "outofscope.pgc"
+
+
+ while (1)
+ {
+ memset(myvar, 0, sizeof(MYTYPE));
+ get_record1();
+ if (sqlca.sqlcode == SQLNOTFOUND)
+ break;
+ printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s\n",
+ myvar->id, mynullvar->id ? " (NULL)" : "",
+ myvar->t, mynullvar->t ? " (NULL)" : "",
+ myvar->d1, mynullvar->d1 ? " (NULL)" : "",
+ myvar->d2, mynullvar->d2 ? " (NULL)" : "",
+ myvar->c, mynullvar->c ? " (NULL)" : "");
+ }
+
+ close_cur1();
+
+ /* Test out-of-scope DECLARE/OPEN/FETCH/CLOSE interaction
+ * with a dynamic cursor and prepared statment using an sqlda
+ */
+
+ prepare2();
+ declare2();
+ open_cur2();
+
+ get_record2();
+ dump_sqlda(outp_sqlda);
+
+ close_cur2();
+ dealloc_prep2();
+
+ /* End test */
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table a1", ECPGt_EOIT, ECPGt_EORT);
+ #line 247 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 247 "outofscope.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+ #line 250 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 250 "outofscope.pgc"
+
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "CURRENT");
+ #line 253 "outofscope.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 253 "outofscope.pgc"
+
+
+ return (0);
+ }
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-outofscope.stderr pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-outofscope.stderr
*** pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-outofscope.stderr 1970-01-01 01:00:00.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-outofscope.stderr 2009-11-16 11:35:10.000000000 +0100
***************
*** 0 ****
--- 1,170 ----
+ [NO_PID]: ECPGdebug: set to 1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 193: query: set datestyle to iso; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 193: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 193: OK: SET
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 196: query: create table a1 ( id serial primary key , t text , d1 numeric , d2 float8 , c character ( 10 ) ); with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 196: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 196: OK: CREATE TABLE
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 199: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'a' , 1.0 , 2 , 'a' ); with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 199: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 199: OK: INSERT 0 1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 200: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , null , null , null , null ); with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 200: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 200: OK: INSERT 0 1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 201: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , '"a"' , - 1.0 , 'nan' :: float8 , 'a' ); with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 201: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 201: OK: INSERT 0 1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 202: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'b' , 2.0 , 3 , 'b' ); with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 202: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 202: OK: INSERT 0 1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGtrans on line 205: action "commit"; connection "regress1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 41: query: declare mycur cursor for select * from a1; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 41: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 41: OK: DECLARE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: query: fetch mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: 1 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: a offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: 1.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: 2 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: a offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: query: fetch mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: 2 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: query: fetch mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: 3 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: "a" offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: -1.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: NaN offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: a offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: query: fetch mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: b offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: 2.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: 3 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 50: RESULT: b offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: query: fetch mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 50: correctly got 0 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: raising sqlcode 100 on line 50: no data found on line 50
+ [NO_PID]: sqlca: code: 100, state: 02000
+ [NO_PID]: ecpg_execute on line 59: query: close mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 59: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 59: OK: CLOSE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGprepare on line 78: name prepared_stmt; query: "SELECT * FROM a1 WHERE id = $1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 116: query: declare mycur cursor for SELECT * FROM a1 WHERE id = $1; with 1 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 116: using PQexecParams
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: free_params on line 116: parameter 1 = 4
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 116: OK: DECLARE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 134: query: fetch mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 134: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 134: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 134: new sqlda was built
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 134: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 134: RESULT: 2.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 134: RESULT: 3 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 134: putting result (1 tuple 5 fields) into sqlda descriptor
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 125: query: close mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 125: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 125: OK: CLOSE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGdeallocate on line 106: name prepared_stmt
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 247: query: drop table a1; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 247: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 247: OK: DROP TABLE
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGtrans on line 250: action "commit"; connection "regress1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_finish: connection regress1 closed
+ [NO_PID]: sqlca: code: 0, state: 00000
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-outofscope.stdout pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-outofscope.stdout
*** pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-outofscope.stdout 1970-01-01 01:00:00.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-outofscope.stdout 2009-11-16 11:35:10.000000000 +0100
***************
*** 0 ****
--- 1,9 ----
+ id=1 t='a' d1=1.000000 d2=2.000000 c = 'a '
+ id=2 t='' (NULL) d1=0.000000 (NULL) d2=0.000000 (NULL) c = '' (NULL)
+ id=3 t='"a"' d1=-1.000000 d2=nan c = 'a '
+ id=4 t='b' d1=2.000000 d2=3.000000 c = 'b '
+ name sqlda descriptor: 'id' value 4
+ name sqlda descriptor: 't' value 'b'
+ name sqlda descriptor: 'd1' value DECIMAL '2.0'
+ name sqlda descriptor: 'd2' value 3.000000
+ name sqlda descriptor: 'c' value 'b '
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-struct.c pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-struct.c
*** pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-struct.c 1970-01-01 01:00:00.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-struct.c 2009-11-16 11:35:10.000000000 +0100
***************
*** 0 ****
--- 1,265 ----
+ /* Processed by ecpg (regression mode) */
+ /* These include files are added by the preprocessor */
+ #include <ecpglib.h>
+ #include <ecpgerrno.h>
+ #include <sqlca.h>
+ /* Needed for informix compatibility */
+ #include <ecpg_informix.h>
+ /* End of automatic include section */
+ #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))
+
+ #line 1 "struct.pgc"
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+
+
+ #line 1 "regression.h"
+
+
+
+
+
+
+ #line 5 "struct.pgc"
+
+
+ /* exec sql begin declare section */
+
+ #line 1 "struct.h"
+
+
+
+
+ /* dec_t */
+
+
+
+ typedef struct mytype MYTYPE ;
+
+ #line 9 "struct.h"
+
+
+
+
+
+
+
+
+
+ typedef struct mynulltype MYNULLTYPE ;
+
+ #line 18 "struct.h"
+
+
+ #line 8 "struct.pgc"
+
+ struct mytype {
+ #line 3 "struct.h"
+ int id ;
+
+ #line 4 "struct.h"
+ char t [ 64 ] ;
+
+ #line 5 "struct.h"
+ double d1 ;
+
+ #line 6 "struct.h"
+ double d2 ;
+
+ #line 7 "struct.h"
+ char c [ 30 ] ;
+ } ; struct mynulltype {
+ #line 12 "struct.h"
+ int id ;
+
+ #line 13 "struct.h"
+ int t ;
+
+ #line 14 "struct.h"
+ int d1 ;
+
+ #line 15 "struct.h"
+ int d2 ;
+
+ #line 16 "struct.h"
+ int c ;
+ } ;/* exec sql end declare section */
+ #line 9 "struct.pgc"
+
+
+ /* exec sql whenever sqlerror stop ; */
+ #line 11 "struct.pgc"
+
+
+ int
+ main (void)
+ {
+ /* exec sql begin declare section */
+
+
+
+ #line 17 "struct.pgc"
+ MYTYPE myvar ;
+
+ #line 18 "struct.pgc"
+ MYNULLTYPE mynullvar ;
+ /* exec sql end declare section */
+ #line 19 "struct.pgc"
+
+
+ char msg[128];
+
+ ECPGdebug(1, stderr);
+
+ strcpy(msg, "connect");
+ { ECPGconnect(__LINE__, 1, "regress1" , NULL, NULL , NULL, 0);
+ #line 26 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 26 "struct.pgc"
+
+
+ strcpy(msg, "set");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT);
+ #line 29 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 29 "struct.pgc"
+
+
+ strcpy(msg, "create");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "create table a1 ( id serial primary key , t text , d1 numeric , d2 float8 , c character ( 10 ) )", ECPGt_EOIT, ECPGt_EORT);
+ #line 32 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 32 "struct.pgc"
+
+
+ strcpy(msg, "insert");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'a' , 1.0 , 2 , 'a' )", ECPGt_EOIT, ECPGt_EORT);
+ #line 35 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 35 "struct.pgc"
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , null , null , null , null )", ECPGt_EOIT, ECPGt_EORT);
+ #line 36 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 36 "struct.pgc"
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , '\"a\"' , - 1.0 , 'nan' :: float8 , 'a' )", ECPGt_EOIT, ECPGt_EORT);
+ #line 37 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 37 "struct.pgc"
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'b' , 2.0 , 3 , 'b' )", ECPGt_EOIT, ECPGt_EORT);
+ #line 38 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 38 "struct.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+ #line 41 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 41 "struct.pgc"
+
+
+ /* Test DECLARE ... SELECT ... INTO with struct type */
+
+ ECPG_informix_set_var( 0, &( myvar ), __LINE__);\
+ ECPG_informix_set_var( 1, &( mynullvar ), __LINE__);\
+ ECPG_informix_reset_sqlca(); /* declare mycur cursor for select * from a1 */
+ #line 45 "struct.pgc"
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare mycur cursor for select * from a1", ECPGt_EOIT,
+ ECPGt_int,&(myvar.id),(long)1,(long)1,sizeof(int),
+ ECPGt_int,&(mynullvar.id),(long)1,(long)1,sizeof(int),
+ ECPGt_char,&(myvar.t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_int,&(mynullvar.t),(long)1,(long)1,sizeof(int),
+ ECPGt_double,&(myvar.d1),(long)1,(long)1,sizeof(double),
+ ECPGt_int,&(mynullvar.d1),(long)1,(long)1,sizeof(int),
+ ECPGt_double,&(myvar.d2),(long)1,(long)1,sizeof(double),
+ ECPGt_int,&(mynullvar.d2),(long)1,(long)1,sizeof(int),
+ ECPGt_char,&(myvar.c),(long)30,(long)1,(30)*sizeof(char),
+ ECPGt_int,&(mynullvar.c),(long)1,(long)1,sizeof(int), ECPGt_EORT);
+ #line 46 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 46 "struct.pgc"
+
+
+ /* exec sql whenever not found break ; */
+ #line 48 "struct.pgc"
+
+
+ while (1)
+ {
+ memset(&myvar, 0, sizeof(myvar));
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch mycur", ECPGt_EOIT,
+ ECPGt_int,&(myvar.id),(long)1,(long)1,sizeof(int),
+ ECPGt_int,&(mynullvar.id),(long)1,(long)1,sizeof(int),
+ ECPGt_char,&(myvar.t),(long)64,(long)1,(64)*sizeof(char),
+ ECPGt_int,&(mynullvar.t),(long)1,(long)1,sizeof(int),
+ ECPGt_double,&(myvar.d1),(long)1,(long)1,sizeof(double),
+ ECPGt_int,&(mynullvar.d1),(long)1,(long)1,sizeof(int),
+ ECPGt_double,&(myvar.d2),(long)1,(long)1,sizeof(double),
+ ECPGt_int,&(mynullvar.d2),(long)1,(long)1,sizeof(int),
+ ECPGt_char,&(myvar.c),(long)30,(long)1,(30)*sizeof(char),
+ ECPGt_int,&(mynullvar.c),(long)1,(long)1,sizeof(int), ECPGt_EORT);
+ #line 53 "struct.pgc"
+
+ if (sqlca.sqlcode == ECPG_NOT_FOUND) break;
+ #line 53 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 53 "struct.pgc"
+
+ printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s\n",
+ myvar.id, mynullvar.id ? " (NULL)" : "",
+ myvar.t, mynullvar.t ? " (NULL)" : "",
+ myvar.d1, mynullvar.d1 ? " (NULL)" : "",
+ myvar.d2, mynullvar.d2 ? " (NULL)" : "",
+ myvar.c, mynullvar.c ? " (NULL)" : "");
+ }
+
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "close mycur", ECPGt_EOIT, ECPGt_EORT);
+ #line 62 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 62 "struct.pgc"
+
+
+ /* End test */
+
+ strcpy(msg, "drop");
+ { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table a1", ECPGt_EOIT, ECPGt_EORT);
+ #line 67 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 67 "struct.pgc"
+
+
+ strcpy(msg, "commit");
+ { ECPGtrans(__LINE__, NULL, "commit");
+ #line 70 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 70 "struct.pgc"
+
+
+ strcpy(msg, "disconnect");
+ { ECPGdisconnect(__LINE__, "CURRENT");
+ #line 73 "struct.pgc"
+
+ if (sqlca.sqlcode < 0) exit (1);}
+ #line 73 "struct.pgc"
+
+
+ return (0);
+ }
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-struct.stderr pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-struct.stderr
*** pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-struct.stderr 1970-01-01 01:00:00.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-struct.stderr 2009-11-16 11:35:10.000000000 +0100
***************
*** 0 ****
--- 1,136 ----
+ [NO_PID]: ECPGdebug: set to 1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 29: query: set datestyle to iso; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 29: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 29: OK: SET
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 32: query: create table a1 ( id serial primary key , t text , d1 numeric , d2 float8 , c character ( 10 ) ); with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 32: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 32: OK: CREATE TABLE
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 35: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'a' , 1.0 , 2 , 'a' ); with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 35: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 35: OK: INSERT 0 1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 36: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , null , null , null , null ); with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 36: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 36: OK: INSERT 0 1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 37: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , '"a"' , - 1.0 , 'nan' :: float8 , 'a' ); with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 37: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 37: OK: INSERT 0 1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 38: query: insert into a1 ( id , t , d1 , d2 , c ) values ( default , 'b' , 2.0 , 3 , 'b' ); with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 38: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 38: OK: INSERT 0 1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGtrans on line 41: action "commit"; connection "regress1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 46: query: declare mycur cursor for select * from a1; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 46: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 46: OK: DECLARE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: query: fetch mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: 1 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: a offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: 1.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: 2 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: a offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: query: fetch mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: 2 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: query: fetch mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: 3 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: "a" offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: -1.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: NaN offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: a offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: query: fetch mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: correctly got 1 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: 4 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: b offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: 2.0 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: 3 offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_get_data on line 53: RESULT: b offset: -1; array: yes
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: query: fetch mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 53: correctly got 0 tuples with 5 fields
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: raising sqlcode 100 on line 53: no data found on line 53
+ [NO_PID]: sqlca: code: 100, state: 02000
+ [NO_PID]: ecpg_execute on line 62: query: close mycur; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 62: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 62: OK: CLOSE CURSOR
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 67: query: drop table a1; with 0 parameter(s) on connection regress1
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 67: using PQexec
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_execute on line 67: OK: DROP TABLE
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ECPGtrans on line 70: action "commit"; connection "regress1"
+ [NO_PID]: sqlca: code: 0, state: 00000
+ [NO_PID]: ecpg_finish: connection regress1 closed
+ [NO_PID]: sqlca: code: 0, state: 00000
diff -dcrpN pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-struct.stdout pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-struct.stdout
*** pgsql.3/src/interfaces/ecpg/test/expected/compat_informix-struct.stdout 1970-01-01 01:00:00.000000000 +0100
--- pgsql.4/src/interfaces/ecpg/test/expected/compat_informix-struct.stdout 2009-11-16 11:35:10.000000000 +0100
***************
*** 0 ****
--- 1,4 ----
+ id=1 t='a' d1=1.000000 d2=2.000000 c = 'a '
+ id=2 t='' (NULL) d1=0.000000 (NULL) d2=0.000000 (NULL) c = '' (NULL)
+ id=3 t='"a"' d1=-1.000000 d2=nan c = 'a '
+ id=4 t='b' d1=2.000000 d2=3.000000 c = 'b '