Commit 5d34af42 authored by Michael Meskes's avatar Michael Meskes

Added STRING datatype for Informix compatibility mode. This work is

based on a patch send in by Böszörményi Zoltán <zb@cybertec.at>.
parent 06f1f53e
...@@ -2412,6 +2412,12 @@ Mon, 02 Feb 2009 16:34:53 +0100 ...@@ -2412,6 +2412,12 @@ Mon, 02 Feb 2009 16:34:53 +0100
- Fixed auto allocation for binary data types. - Fixed auto allocation for binary data types.
- Set pgtypes library version to 3.1. - Set pgtypes library version to 3.1.
- Set compat library version to 3.1. - Set compat library version to 3.1.
- Set ecpg library version to 6.2. - Set ecpg library version to 6.1.
- Set ecpg version to 4.5. - Set ecpg version to 4.5.
Fri, 07 Aug 2009 10:41:28 +0200
- Added STRING datatype for Informix compatibility mode. This work is
based on a patch send in by Böszörményi Zoltán <zb@cybertec.at>.
- Set ecpg library version to 6.2.
- Set ecpg version to 4.6.
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.43 2009/07/13 01:37:05 momjian Exp $ # $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.44 2009/08/07 10:51:20 meskes Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -15,7 +15,7 @@ include $(top_builddir)/src/Makefile.global ...@@ -15,7 +15,7 @@ include $(top_builddir)/src/Makefile.global
NAME= ecpg_compat NAME= ecpg_compat
SO_MAJOR_VERSION= 3 SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 2 SO_MINOR_VERSION= 1
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) -I$(top_srcdir)/src/include/utils $(CPPFLAGS) -I$(libpq_srcdir) -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
......
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.42 2009/01/15 11:52:55 petere Exp $ */ /* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.43 2009/08/07 10:51:20 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL #define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -138,6 +138,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -138,6 +138,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
case ECPGt_char: case ECPGt_char:
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
case ECPGt_varchar: case ECPGt_varchar:
case ECPGt_string:
break; break;
default: default:
...@@ -389,13 +390,29 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, ...@@ -389,13 +390,29 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
case ECPGt_char: case ECPGt_char:
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
case ECPGt_string:
if (pval) if (pval)
{ {
char *str = (char *) ((long) var + offset * act_tuple);
if (varcharsize == 0 || varcharsize > size) if (varcharsize == 0 || varcharsize > size)
strncpy((char *) ((long) var + offset * act_tuple), pval, size + 1); {
char *last;
strncpy(str, pval, size + 1);
/* do the rtrim() */
if (type == ECPGt_string)
{
char *last = str + size;
while (last > str && (*last == ' ' || *last == '\0'))
{
*last = '\0';
last--;
}
}
}
else else
{ {
strncpy((char *) ((long) var + offset * act_tuple), pval, varcharsize); strncpy(str, pval, varcharsize);
if (varcharsize < size) if (varcharsize < size)
{ {
......
/* dynamic SQL support routines /* dynamic SQL support routines
* *
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.32 2009/06/11 14:49:13 momjian Exp $ * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.33 2009/08/07 10:51:20 meskes Exp $
*/ */
#define POSTGRES_ECPG_INTERNAL #define POSTGRES_ECPG_INTERNAL
...@@ -200,6 +200,7 @@ get_char_item(int lineno, void *var, enum ECPGttype vartype, char *value, int va ...@@ -200,6 +200,7 @@ get_char_item(int lineno, void *var, enum ECPGttype vartype, char *value, int va
{ {
case ECPGt_char: case ECPGt_char:
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
case ECPGt_string:
strncpy((char *) var, value, varcharsize); strncpy((char *) var, value, varcharsize);
break; break;
case ECPGt_varchar: case ECPGt_varchar:
......
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.85 2009/06/11 14:49:13 momjian Exp $ */ /* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.86 2009/08/07 10:51:20 meskes Exp $ */
/* /*
* The aim is to get a simpler inteface to the database routines. * The aim is to get a simpler inteface to the database routines.
...@@ -359,6 +359,7 @@ ecpg_store_result(const PGresult *results, int act_field, ...@@ -359,6 +359,7 @@ ecpg_store_result(const PGresult *results, int act_field,
{ {
case ECPGt_char: case ECPGt_char:
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
case ECPGt_string:
if (!var->varcharsize && !var->arrsize) if (!var->varcharsize && !var->arrsize)
{ {
/* special mode for handling char**foo=0 */ /* special mode for handling char**foo=0 */
...@@ -418,7 +419,7 @@ ecpg_store_result(const PGresult *results, int act_field, ...@@ -418,7 +419,7 @@ ecpg_store_result(const PGresult *results, int act_field,
/* fill the variable with the tuple(s) */ /* fill the variable with the tuple(s) */
if (!var->varcharsize && !var->arrsize && if (!var->varcharsize && !var->arrsize &&
(var->type == ECPGt_char || var->type == ECPGt_unsigned_char)) (var->type == ECPGt_char || var->type == ECPGt_unsigned_char || var->type == ECPGt_string))
{ {
/* special mode for handling char**foo=0 */ /* special mode for handling char**foo=0 */
...@@ -757,6 +758,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari ...@@ -757,6 +758,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
case ECPGt_char: case ECPGt_char:
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
case ECPGt_string:
{ {
/* set slen to string length if type is char * */ /* set slen to string length if type is char * */
int slen = (var->varcharsize == 0) ? strlen((char *) var->value) : (unsigned int) var->varcharsize; int slen = (var->varcharsize == 0) ? strlen((char *) var->value) : (unsigned int) var->varcharsize;
......
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.49 2009/06/11 14:49:13 momjian Exp $ */ /* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.50 2009/08/07 10:51:20 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL #define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -295,6 +295,7 @@ ECPGset_noind_null(enum ECPGttype type, void *ptr) ...@@ -295,6 +295,7 @@ ECPGset_noind_null(enum ECPGttype type, void *ptr)
{ {
case ECPGt_char: case ECPGt_char:
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
case ECPGt_string:
*((char *) ptr) = '\0'; *((char *) ptr) = '\0';
break; break;
case ECPGt_short: case ECPGt_short:
...@@ -361,6 +362,7 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr) ...@@ -361,6 +362,7 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr)
{ {
case ECPGt_char: case ECPGt_char:
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
case ECPGt_string:
if (*((char *) ptr) == '\0') if (*((char *) ptr) == '\0')
return true; return true;
break; break;
......
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/typename.c,v 1.14 2007/11/15 21:14:45 momjian Exp $ */ /* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/typename.c,v 1.15 2009/08/07 10:51:20 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL #define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -19,6 +19,7 @@ ecpg_type_name(enum ECPGttype typ) ...@@ -19,6 +19,7 @@ ecpg_type_name(enum ECPGttype typ)
switch (typ) switch (typ)
{ {
case ECPGt_char: case ECPGt_char:
case ECPGt_string:
return "char"; return "char";
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
return "unsigned char"; return "unsigned char";
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* All types that can be handled for host variable declarations has to * All types that can be handled for host variable declarations has to
* be handled eventually. * be handled eventually.
* *
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpgtype.h,v 1.37 2007/08/14 10:01:52 meskes Exp $ * $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpgtype.h,v 1.38 2009/08/07 10:51:20 meskes Exp $
*/ */
/* /*
...@@ -61,7 +61,8 @@ enum ECPGttype ...@@ -61,7 +61,8 @@ enum ECPGttype
ECPGt_const, /* a constant is needed sometimes */ ECPGt_const, /* a constant is needed sometimes */
ECPGt_EOIT, /* End of insert types. */ ECPGt_EOIT, /* End of insert types. */
ECPGt_EORT, /* End of result types. */ ECPGt_EORT, /* End of result types. */
ECPGt_NO_INDICATOR /* no indicator */ ECPGt_NO_INDICATOR, /* no indicator */
ECPGt_string /* trimmed (char *) type */
}; };
/* descriptor items */ /* descriptor items */
...@@ -86,7 +87,7 @@ enum ECPGdtype ...@@ -86,7 +87,7 @@ enum ECPGdtype
ECPGd_cardinality ECPGd_cardinality
}; };
#define IS_SIMPLE_TYPE(type) ((type) >= ECPGt_char && (type) <= ECPGt_interval) #define IS_SIMPLE_TYPE(type) (((type) >= ECPGt_char && (type) <= ECPGt_interval) || ((type) == ECPGt_string))
/* we also have to handle different statement types */ /* we also have to handle different statement types */
enum ECPG_statement_type enum ECPG_statement_type
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.44 2009/07/13 01:37:05 momjian Exp $ # $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.45 2009/08/07 10:51:20 meskes Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -15,7 +15,7 @@ include $(top_builddir)/src/Makefile.global ...@@ -15,7 +15,7 @@ include $(top_builddir)/src/Makefile.global
NAME= pgtypes NAME= pgtypes
SO_MAJOR_VERSION= 3 SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 2 SO_MINOR_VERSION= 1
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(top_srcdir)/src/include/utils -I$(libpq_srcdir) $(CPPFLAGS) -I$(top_srcdir)/src/include/utils -I$(libpq_srcdir) $(CPPFLAGS)
......
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.7 2009/06/10 23:11:52 petere Exp $ */ /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.8 2009/08/07 10:51:20 meskes Exp $ */
/* Copyright comment */ /* Copyright comment */
%{ %{
...@@ -256,12 +256,12 @@ adjust_informix(struct arguments *list) ...@@ -256,12 +256,12 @@ adjust_informix(struct arguments *list)
original_var = ptr->variable->name; original_var = ptr->variable->name;
sprintf(temp, "%d))", ecpg_informix_var); 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) && atoi(ptr->variable->type->size) > 1) 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); 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++); 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) && atoi(ptr->variable->type->size) > 1) 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); 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++); sprintf(temp, "%d, (", ecpg_informix_var++);
...@@ -343,6 +343,8 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu ...@@ -343,6 +343,8 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
type_enum == ECPGt_union) && type_enum == ECPGt_union) &&
initializer == 1) initializer == 1)
mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in type definition"); mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in type definition");
else if (INFORMIX_MODE && strcmp(name, "string") == 0)
mmerror(PARSE_ERROR, ET_ERROR, "type name \"string\" is reserved in Informix mode");
else else
{ {
for (ptr = types; ptr != NULL; ptr = ptr->next) for (ptr = types; ptr != NULL; ptr = ptr->next)
...@@ -371,6 +373,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu ...@@ -371,6 +373,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
if (type_enum != ECPGt_varchar && if (type_enum != ECPGt_varchar &&
type_enum != ECPGt_char && type_enum != ECPGt_char &&
type_enum != ECPGt_unsigned_char && type_enum != ECPGt_unsigned_char &&
type_enum != ECPGt_string &&
atoi(this->type->type_index) >= 0) atoi(this->type->type_index) >= 0)
mmerror(PARSE_ERROR, ET_ERROR, "multidimensional arrays for simple data types are not supported"); mmerror(PARSE_ERROR, ET_ERROR, "multidimensional arrays for simple data types are not supported");
......
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.9 2009/06/10 23:11:52 petere Exp $ */ /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.10 2009/08/07 10:51:20 meskes Exp $ */
statements: /*EMPTY*/ statements: /*EMPTY*/
| statements statement | statements statement
...@@ -213,6 +213,7 @@ char_variable: cvariable ...@@ -213,6 +213,7 @@ char_variable: cvariable
{ {
case ECPGt_char: case ECPGt_char:
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
case ECPGt_string:
$$ = $1; $$ = $1;
break; break;
case ECPGt_varchar: case ECPGt_varchar:
...@@ -587,6 +588,14 @@ var_type: simple_type ...@@ -587,6 +588,14 @@ var_type: simple_type
$$.type_index = make_str("-1"); $$.type_index = make_str("-1");
$$.type_sizeof = NULL; $$.type_sizeof = NULL;
} }
else if ((strcmp($1, "string") == 0) && INFORMIX_MODE)
{
$$.type_enum = ECPGt_string;
$$.type_str = make_str("char");
$$.type_dimension = make_str("-1");
$$.type_index = make_str("-1");
$$.type_sizeof = NULL;
}
else else
{ {
/* this is for typedef'ed types */ /* this is for typedef'ed types */
...@@ -849,6 +858,7 @@ variable: opt_pointer ECPGColLabel opt_array_bounds opt_bit_field opt_initialize ...@@ -849,6 +858,7 @@ variable: opt_pointer ECPGColLabel opt_array_bounds opt_bit_field opt_initialize
case ECPGt_char: case ECPGt_char:
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
case ECPGt_string:
if (atoi(dimension) == -1) if (atoi(dimension) == -1)
{ {
int i = strlen($5); int i = strlen($5);
...@@ -1269,6 +1279,7 @@ ECPGVar: SQL_VAR ...@@ -1269,6 +1279,7 @@ ECPGVar: SQL_VAR
case ECPGt_char: case ECPGt_char:
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
case ECPGt_string:
if (atoi(dimension) == -1) if (atoi(dimension) == -1)
type = ECPGmake_simple_type($5.type_enum, length, 0); type = ECPGmake_simple_type($5.type_enum, length, 0);
else else
......
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.83 2009/06/11 14:49:13 momjian Exp $ */ /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.84 2009/08/07 10:51:20 meskes Exp $ */
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -200,6 +200,9 @@ get_type(enum ECPGttype type) ...@@ -200,6 +200,9 @@ get_type(enum ECPGttype type)
case ECPGt_timestamp: case ECPGt_timestamp:
return ("ECPGt_timestamp"); return ("ECPGt_timestamp");
break; break;
case ECPGt_string:
return ("ECPGt_string");
break;
default: default:
mmerror(PARSE_ERROR, ET_ERROR, "unrecognized variable type code %d", type); mmerror(PARSE_ERROR, ET_ERROR, "unrecognized variable type code %d", type);
} }
...@@ -366,6 +369,7 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type, ...@@ -366,6 +369,7 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
case ECPGt_char: case ECPGt_char:
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
case ECPGt_char_variable: case ECPGt_char_variable:
case ECPGt_string:
/* /*
* we have to use the pointer except for arrays with given * we have to use the pointer except for arrays with given
......
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/variable.c,v 1.49 2009/06/11 14:49:13 momjian Exp $ */ /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/variable.c,v 1.50 2009/08/07 10:51:20 meskes Exp $ */
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -500,7 +500,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty ...@@ -500,7 +500,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
"multilevel pointers (more than 2 levels) are not supported; found %d levels", pointer_len), "multilevel pointers (more than 2 levels) are not supported; found %d levels", pointer_len),
pointer_len); pointer_len);
if (pointer_len > 1 && type_enum != ECPGt_char && type_enum != ECPGt_unsigned_char) if (pointer_len > 1 && type_enum != ECPGt_char && type_enum != ECPGt_unsigned_char && type_enum != ECPGt_string)
mmerror(PARSE_ERROR, ET_FATAL, "pointer to pointer is not supported for this data type"); mmerror(PARSE_ERROR, ET_FATAL, "pointer to pointer is not supported for this data type");
if (pointer_len > 1 && (atoi(*length) >= 0 || atoi(*dimension) >= 0)) if (pointer_len > 1 && (atoi(*length) >= 0 || atoi(*dimension) >= 0))
...@@ -539,6 +539,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty ...@@ -539,6 +539,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
break; break;
case ECPGt_char: case ECPGt_char:
case ECPGt_unsigned_char: case ECPGt_unsigned_char:
case ECPGt_string:
/* char ** */ /* char ** */
if (pointer_len == 2) if (pointer_len == 2)
{ {
......
...@@ -13,6 +13,7 @@ int main(void) ...@@ -13,6 +13,7 @@ int main(void)
{ {
$int i = 14; $int i = 14;
$decimal j, m, n; $decimal j, m, n;
$string c[10];
ECPGdebug(1, stderr); ECPGdebug(1, stderr);
$whenever sqlerror do dosqlprint(); $whenever sqlerror do dosqlprint();
...@@ -20,19 +21,19 @@ int main(void) ...@@ -20,19 +21,19 @@ int main(void)
$connect to REGRESSDB1; $connect to REGRESSDB1;
if (sqlca.sqlcode != 0) exit(1); if (sqlca.sqlcode != 0) exit(1);
$create table test(i int primary key, j int); $create table test(i int primary key, j int, c text);
/* this INSERT works */ /* this INSERT works */
rsetnull(CDECIMALTYPE, (char *)&j); rsetnull(CDECIMALTYPE, (char *)&j);
$insert into test (i, j) values (7, :j); $insert into test (i, j, c) values (7, :j, 'test ');
$commit; $commit;
/* this INSERT should fail because i is a unique column */ /* this INSERT should fail because i is a unique column */
$insert into test (i, j) values (7, NUMBER); $insert into test (i, j, c) values (7, NUMBER, 'a');
printf("INSERT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); printf("INSERT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode != 0) $rollback; if (sqlca.sqlcode != 0) $rollback;
$insert into test (i, j) values (:i, 1); $insert into test (i, j, c) values (:i, 1, 'a ');
$commit; $commit;
/* this will fail (more than one row in subquery) */ /* this will fail (more than one row in subquery) */
...@@ -51,7 +52,7 @@ int main(void) ...@@ -51,7 +52,7 @@ int main(void)
while (1) while (1)
{ {
$fetch forward c into :i, :j; $fetch forward c into :i, :j, :c;
if (sqlca.sqlcode == 100) break; if (sqlca.sqlcode == 100) break;
else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode); else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode);
...@@ -62,7 +63,7 @@ int main(void) ...@@ -62,7 +63,7 @@ int main(void)
int a; int a;
dectoint(&j, &a); dectoint(&j, &a);
printf("%d %d\n", i, a); printf("%d %d \"%s\"\n", i, a, c);
} }
} }
......
...@@ -43,106 +43,112 @@ int main(void) ...@@ -43,106 +43,112 @@ int main(void)
#line 15 "test_informix.pgc" #line 15 "test_informix.pgc"
#line 16 "test_informix.pgc"
char c [ 10 ] ;
#line 16 "test_informix.pgc"
ECPGdebug(1, stderr); ECPGdebug(1, stderr);
/* exec sql whenever sqlerror do dosqlprint ( ) ; */ /* exec sql whenever sqlerror do dosqlprint ( ) ; */
#line 18 "test_informix.pgc" #line 19 "test_informix.pgc"
{ ECPGconnect(__LINE__, 1, "regress1" , NULL, NULL , NULL, 0); { ECPGconnect(__LINE__, 1, "regress1" , NULL, NULL , NULL, 0);
#line 20 "test_informix.pgc" #line 21 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 20 "test_informix.pgc" #line 21 "test_informix.pgc"
if (sqlca.sqlcode != 0) exit(1); if (sqlca.sqlcode != 0) exit(1);
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "create table test ( i int primary key , j int )", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "create table test ( i int primary key , j int , c text )", ECPGt_EOIT, ECPGt_EORT);
#line 23 "test_informix.pgc" #line 24 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 23 "test_informix.pgc" #line 24 "test_informix.pgc"
/* this INSERT works */ /* this INSERT works */
rsetnull(CDECIMALTYPE, (char *)&j); rsetnull(CDECIMALTYPE, (char *)&j);
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into test ( i , j ) values ( 7 , $1 )", { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into test ( i , j , c ) values ( 7 , $1 , 'test ' )",
ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal), ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 27 "test_informix.pgc" #line 28 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 27 "test_informix.pgc" #line 28 "test_informix.pgc"
{ ECPGtrans(__LINE__, NULL, "commit"); { ECPGtrans(__LINE__, NULL, "commit");
#line 28 "test_informix.pgc" #line 29 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 28 "test_informix.pgc" #line 29 "test_informix.pgc"
/* this INSERT should fail because i is a unique column */ /* this INSERT should fail because i is a unique column */
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into test ( i , j ) values ( 7 , 12 )", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into test ( i , j , c ) values ( 7 , 12 , 'a' )", ECPGt_EOIT, ECPGt_EORT);
#line 31 "test_informix.pgc" #line 32 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 31 "test_informix.pgc" #line 32 "test_informix.pgc"
printf("INSERT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); printf("INSERT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback"); if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback");
#line 33 "test_informix.pgc" #line 34 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 33 "test_informix.pgc" #line 34 "test_informix.pgc"
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into test ( i , j ) values ( $1 , 1 )", { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into test ( i , j , c ) values ( $1 , 1 , 'a ' )",
ECPGt_int,&(i),(long)1,(long)1,sizeof(int), ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 35 "test_informix.pgc" #line 36 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 35 "test_informix.pgc" #line 36 "test_informix.pgc"
{ ECPGtrans(__LINE__, NULL, "commit"); { ECPGtrans(__LINE__, NULL, "commit");
#line 36 "test_informix.pgc" #line 37 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 36 "test_informix.pgc" #line 37 "test_informix.pgc"
/* this will fail (more than one row in subquery) */ /* this will fail (more than one row in subquery) */
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select i from test where j = ( select j from test )", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select i from test where j = ( select j from test )", ECPGt_EOIT, ECPGt_EORT);
#line 39 "test_informix.pgc" #line 40 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 39 "test_informix.pgc" #line 40 "test_informix.pgc"
{ ECPGtrans(__LINE__, NULL, "rollback"); { ECPGtrans(__LINE__, NULL, "rollback");
#line 40 "test_informix.pgc" #line 41 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 40 "test_informix.pgc" #line 41 "test_informix.pgc"
/* this however should be ok */ /* this however should be ok */
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select i from test where j = ( select j from test order by i limit 1 )", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select i from test where j = ( select j from test order by i limit 1 )", ECPGt_EOIT, ECPGt_EORT);
#line 43 "test_informix.pgc" #line 44 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 43 "test_informix.pgc" #line 44 "test_informix.pgc"
printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback"); if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback");
#line 45 "test_informix.pgc" #line 46 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 45 "test_informix.pgc" #line 46 "test_informix.pgc"
ECPG_informix_set_var( 0, &( i ), __LINE__);\ ECPG_informix_set_var( 0, &( i ), __LINE__);\
/* declare c cursor for select * from test where i <= $1 */ /* declare c cursor for select * from test where i <= $1 */
#line 47 "test_informix.pgc" #line 48 "test_informix.pgc"
openit(); openit();
...@@ -154,11 +160,13 @@ if (sqlca.sqlcode < 0) dosqlprint ( );} ...@@ -154,11 +160,13 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
ECPGt_int,&(i),(long)1,(long)1,sizeof(int), ECPGt_int,&(i),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal), ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_string,(c),(long)10,(long)1,(10)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
#line 54 "test_informix.pgc" #line 55 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 54 "test_informix.pgc" #line 55 "test_informix.pgc"
if (sqlca.sqlcode == 100) break; if (sqlca.sqlcode == 100) break;
else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode); else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode);
...@@ -170,7 +178,7 @@ if (sqlca.sqlcode < 0) dosqlprint ( );} ...@@ -170,7 +178,7 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
int a; int a;
dectoint(&j, &a); dectoint(&j, &a);
printf("%d %d\n", i, a); printf("%d %d \"%s\"\n", i, a, c);
} }
} }
...@@ -180,53 +188,53 @@ if (sqlca.sqlcode < 0) dosqlprint ( );} ...@@ -180,53 +188,53 @@ if (sqlca.sqlcode < 0) dosqlprint ( );}
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "delete from test where i = $1 :: decimal", { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "delete from test where i = $1 :: decimal",
ECPGt_decimal,&(n),(long)1,(long)1,sizeof(decimal), ECPGt_decimal,&(n),(long)1,(long)1,sizeof(decimal),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 72 "test_informix.pgc" #line 73 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 72 "test_informix.pgc" #line 73 "test_informix.pgc"
printf("DELETE: %ld\n", sqlca.sqlcode); printf("DELETE: %ld\n", sqlca.sqlcode);
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select 1 from test where i = 14", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select 1 from test where i = 14", ECPGt_EOIT, ECPGt_EORT);
#line 75 "test_informix.pgc" #line 76 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 75 "test_informix.pgc" #line 76 "test_informix.pgc"
printf("Exists: %ld\n", sqlca.sqlcode); printf("Exists: %ld\n", sqlca.sqlcode);
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select 1 from test where i = 147", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "select 1 from test where i = 147", ECPGt_EOIT, ECPGt_EORT);
#line 78 "test_informix.pgc" #line 79 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 78 "test_informix.pgc" #line 79 "test_informix.pgc"
printf("Does not exist: %ld\n", sqlca.sqlcode); printf("Does not exist: %ld\n", sqlca.sqlcode);
{ ECPGtrans(__LINE__, NULL, "commit"); { ECPGtrans(__LINE__, NULL, "commit");
#line 81 "test_informix.pgc" #line 82 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 81 "test_informix.pgc" #line 82 "test_informix.pgc"
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT); { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table test", ECPGt_EOIT, ECPGt_EORT);
#line 82 "test_informix.pgc" #line 83 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 82 "test_informix.pgc" #line 83 "test_informix.pgc"
{ ECPGtrans(__LINE__, NULL, "commit"); { ECPGtrans(__LINE__, NULL, "commit");
#line 83 "test_informix.pgc" #line 84 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 83 "test_informix.pgc" #line 84 "test_informix.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT"); { ECPGdisconnect(__LINE__, "CURRENT");
#line 85 "test_informix.pgc" #line 86 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 85 "test_informix.pgc" #line 86 "test_informix.pgc"
return 0; return 0;
...@@ -237,10 +245,10 @@ static void openit(void) ...@@ -237,10 +245,10 @@ static void openit(void)
{ ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare c cursor for select * from test where i <= $1 ", { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare c cursor for select * from test where i <= $1 ",
ECPGt_int,&(*( int *)(ECPG_informix_get_var( 0))),(long)1,(long)1,sizeof(int), ECPGt_int,&(*( int *)(ECPG_informix_get_var( 0))),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
#line 92 "test_informix.pgc" #line 93 "test_informix.pgc"
if (sqlca.sqlcode < 0) dosqlprint ( );} if (sqlca.sqlcode < 0) dosqlprint ( );}
#line 92 "test_informix.pgc" #line 93 "test_informix.pgc"
} }
...@@ -2,128 +2,132 @@ ...@@ -2,128 +2,132 @@
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT> [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 23: query: create table test ( i int primary key , j int ); with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 24: query: create table test ( i int primary key , j int , c text ); with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 23: using PQexec [NO_PID]: ecpg_execute on line 24: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 23: OK: CREATE TABLE [NO_PID]: ecpg_execute on line 24: OK: CREATE TABLE
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 27: query: insert into test ( i , j ) values ( 7 , $1 ); with 1 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 28: query: insert into test ( i , j , c ) values ( 7 , $1 , 'test ' ); with 1 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 27: using PQexecParams [NO_PID]: ecpg_execute on line 28: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: free_params on line 27: parameter 1 = 0 [NO_PID]: free_params on line 28: parameter 1 = 0
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 27: OK: INSERT 0 1 [NO_PID]: ecpg_execute on line 28: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line 28: action "commit"; connection "regress1" [NO_PID]: ECPGtrans on line 29: action "commit"; connection "regress1"
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 31: query: insert into test ( i , j ) values ( 7 , 12 ); with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 32: query: insert into test ( i , j , c ) values ( 7 , 12 , 'a' ); with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 31: using PQexec [NO_PID]: ecpg_execute on line 32: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_check_PQresult on line 31: ERROR: duplicate key value violates unique constraint "test_pkey" [NO_PID]: ecpg_check_PQresult on line 32: ERROR: duplicate key value violates unique constraint "test_pkey"
DETAIL: Key (i)=(7) already exists. DETAIL: Key (i)=(7) already exists.
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 23505 (sqlcode -239) on line 31: duplicate key value violates unique constraint "test_pkey" on line 31 [NO_PID]: raising sqlstate 23505 (sqlcode -239) on line 32: duplicate key value violates unique constraint "test_pkey" on line 32
[NO_PID]: sqlca: code: -239, state: 23505 [NO_PID]: sqlca: code: -239, state: 23505
[NO_PID]: ECPGtrans on line 33: action "rollback"; connection "regress1" [NO_PID]: ECPGtrans on line 34: action "rollback"; connection "regress1"
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 35: query: insert into test ( i , j ) values ( $1 , 1 ); with 1 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 36: query: insert into test ( i , j , c ) values ( $1 , 1 , 'a ' ); with 1 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 35: using PQexecParams [NO_PID]: ecpg_execute on line 36: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: free_params on line 35: parameter 1 = 14 [NO_PID]: free_params on line 36: parameter 1 = 14
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 35: OK: INSERT 0 1 [NO_PID]: ecpg_execute on line 36: OK: INSERT 0 1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line 36: action "commit"; connection "regress1" [NO_PID]: ECPGtrans on line 37: action "commit"; connection "regress1"
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 39: query: select i from test where j = ( select j from test ); with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 40: query: select i from test where j = ( select j from test ); with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 39: using PQexec [NO_PID]: ecpg_execute on line 40: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_check_PQresult on line 39: ERROR: more than one row returned by a subquery used as an expression [NO_PID]: ecpg_check_PQresult on line 40: ERROR: more than one row returned by a subquery used as an expression
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlstate 21000 (sqlcode -284) on line 39: more than one row returned by a subquery used as an expression on line 39 [NO_PID]: raising sqlstate 21000 (sqlcode -284) on line 40: more than one row returned by a subquery used as an expression on line 40
[NO_PID]: sqlca: code: -284, state: 21000 [NO_PID]: sqlca: code: -284, state: 21000
[NO_PID]: ECPGtrans on line 40: action "rollback"; connection "regress1" [NO_PID]: ECPGtrans on line 41: action "rollback"; connection "regress1"
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 43: query: select i from test where j = ( select j from test order by i limit 1 ); with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 44: query: select i from test where j = ( select j from test order by i limit 1 ); with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 43: using PQexec [NO_PID]: ecpg_execute on line 44: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 43: correctly got 1 tuples with 1 fields [NO_PID]: ecpg_execute on line 44: correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 92: query: declare c cursor for select * from test where i <= $1 ; with 1 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 93: query: declare c cursor for select * from test where i <= $1 ; with 1 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 92: using PQexecParams [NO_PID]: ecpg_execute on line 93: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: free_params on line 92: parameter 1 = 14 [NO_PID]: free_params on line 93: parameter 1 = 14
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 92: OK: DECLARE CURSOR [NO_PID]: ecpg_execute on line 93: OK: DECLARE CURSOR
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 54: query: fetch forward from c; with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 55: query: fetch forward from c; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 54: using PQexec [NO_PID]: ecpg_execute on line 55: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 54: correctly got 1 tuples with 2 fields [NO_PID]: ecpg_execute on line 55: correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 54: RESULT: 7 offset: -1; array: yes [NO_PID]: ecpg_get_data on line 55: RESULT: 7 offset: -1; array: yes
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 54: RESULT: 0 offset: -1; array: yes [NO_PID]: ecpg_get_data on line 55: RESULT: 0 offset: -1; array: yes
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 54: query: fetch forward from c; with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_get_data on line 55: RESULT: test offset: -1; array: yes
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 54: using PQexec [NO_PID]: ecpg_execute on line 55: query: fetch forward from c; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 54: correctly got 1 tuples with 2 fields [NO_PID]: ecpg_execute on line 55: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 54: RESULT: 14 offset: -1; array: yes [NO_PID]: ecpg_execute on line 55: correctly got 1 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_get_data on line 54: RESULT: 1 offset: -1; array: yes [NO_PID]: ecpg_get_data on line 55: RESULT: 14 offset: -1; array: yes
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 54: query: fetch forward from c; with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_get_data on line 55: RESULT: 1 offset: -1; array: yes
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 54: using PQexec [NO_PID]: ecpg_get_data on line 55: RESULT: a offset: -1; array: yes
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 54: correctly got 0 tuples with 2 fields [NO_PID]: ecpg_execute on line 55: query: fetch forward from c; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 on line 54: no data found on line 54 [NO_PID]: ecpg_execute on line 55: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 55: correctly got 0 tuples with 3 fields
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 on line 55: no data found on line 55
[NO_PID]: sqlca: code: 100, state: 02000 [NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ecpg_execute on line 72: query: delete from test where i = $1 :: decimal; with 1 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 73: query: delete from test where i = $1 :: decimal; with 1 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 72: using PQexecParams [NO_PID]: ecpg_execute on line 73: using PQexecParams
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: free_params on line 72: parameter 1 = 21.0 [NO_PID]: free_params on line 73: parameter 1 = 21.0
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 72: OK: DELETE 0 [NO_PID]: ecpg_execute on line 73: OK: DELETE 0
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 on line 72: no data found on line 72 [NO_PID]: raising sqlcode 100 on line 73: no data found on line 73
[NO_PID]: sqlca: code: 100, state: 02000 [NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ecpg_execute on line 75: query: select 1 from test where i = 14; with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 76: query: select 1 from test where i = 14; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 75: using PQexec [NO_PID]: ecpg_execute on line 76: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 75: correctly got 1 tuples with 1 fields [NO_PID]: ecpg_execute on line 76: correctly got 1 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 78: query: select 1 from test where i = 147; with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 79: query: select 1 from test where i = 147; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 78: using PQexec [NO_PID]: ecpg_execute on line 79: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 78: correctly got 0 tuples with 1 fields [NO_PID]: ecpg_execute on line 79: correctly got 0 tuples with 1 fields
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: raising sqlcode 100 on line 78: no data found on line 78 [NO_PID]: raising sqlcode 100 on line 79: no data found on line 79
[NO_PID]: sqlca: code: 100, state: 02000 [NO_PID]: sqlca: code: 100, state: 02000
[NO_PID]: ECPGtrans on line 81: action "commit"; connection "regress1" [NO_PID]: ECPGtrans on line 82: action "commit"; connection "regress1"
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 82: query: drop table test; with 0 parameter(s) on connection regress1 [NO_PID]: ecpg_execute on line 83: query: drop table test; with 0 parameter(s) on connection regress1
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 82: using PQexec [NO_PID]: ecpg_execute on line 83: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_execute on line 82: OK: DROP TABLE [NO_PID]: ecpg_execute on line 83: OK: DROP TABLE
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGtrans on line 83: action "commit"; connection "regress1" [NO_PID]: ECPGtrans on line 84: action "commit"; connection "regress1"
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection regress1 closed [NO_PID]: ecpg_finish: connection regress1 closed
[NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: sqlca: code: 0, state: 00000
doSQLprint: Error: duplicate key value violates unique constraint "test_pkey" on line 31 doSQLprint: Error: duplicate key value violates unique constraint "test_pkey" on line 32
INSERT: -239=duplicate key value violates unique constraint "test_pkey" on line 31 INSERT: -239=duplicate key value violates unique constraint "test_pkey" on line 32
doSQLprint: Error: more than one row returned by a subquery used as an expression on line 39 doSQLprint: Error: more than one row returned by a subquery used as an expression on line 40
SELECT: 0= SELECT: 0=
7 0 7 0 "test"
14 1 14 1 "a"
DELETE: 100 DELETE: 100
Exists: 0 Exists: 0
Does not exist: 100 Does not exist: 100
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment