]> granicus.if.org Git - postgresql/commitdiff
Changed ECPG outofscope handling to always print out statements in the same order
authorMichael Meskes <meskes@postgresql.org>
Fri, 29 Jan 2010 16:28:13 +0000 (16:28 +0000)
committerMichael Meskes <meskes@postgresql.org>
Fri, 29 Jan 2010 16:28:13 +0000 (16:28 +0000)
so regression testing is possible,

by Zoltan Boszormenyi

src/interfaces/ecpg/preproc/ecpg.addons
src/interfaces/ecpg/preproc/ecpg.header
src/interfaces/ecpg/preproc/ecpg.trailer
src/interfaces/ecpg/test/expected/preproc-cursor.c
src/interfaces/ecpg/test/expected/preproc-outofscope.c
src/interfaces/ecpg/test/expected/preproc-outofscope.stderr
src/interfaces/ecpg/test/expected/preproc-outofscope.stdout
src/interfaces/ecpg/test/preproc/outofscope.pgc

index 6c5889ec6b42fa7ab76fdc07af692ff937f11ac3..de46f51ca721d59b277f734ce20d2ad3cc1d1677 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.15 2010/01/26 09:07:31 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.16 2010/01/29 16:28:13 meskes Exp $ */
 ECPG: stmtClosePortalStmt block
        {
                if (INFORMIX_MODE)
@@ -331,16 +331,11 @@ ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectSt
                comment = cat_str(3, make_str("/*"), c1, make_str("*/"));
 
                if ((braces_open > 0) && INFORMIX_MODE) /* we're in a function */
-                       $$ = cat_str(4,
-                               adjust_outofscope_cursor_vars(this, true),
-                               adjust_outofscope_cursor_vars(this, false),
+                       $$ = cat_str(3, adjust_outofscope_cursor_vars(this),
                                make_str("ECPG_informix_reset_sqlca();"),
                                comment);
                else
-                       $$ = cat_str(3,
-                               adjust_outofscope_cursor_vars(this, true),
-                               adjust_outofscope_cursor_vars(this, false),
-                               comment);
+                       $$ = cat2_str(adjust_outofscope_cursor_vars(this), comment);
        }
 ECPG: ClosePortalStmtCLOSEcursor_name block
        {
index f2847f667b99100368c509781fdbd2446430066d..167951295c92fb4066b0125a2cfa0317b1a65c53 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.12 2010/01/29 15:57:01 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.13 2010/01/29 16:28:13 meskes Exp $ */
 
 /* Copyright comment */
 %{
@@ -227,7 +227,7 @@ create_questionmarks(char *name, bool array)
 }
 
 static char *
-adjust_outofscope_cursor_vars(struct cursor *cur, bool insert)
+adjust_outofscope_cursor_vars(struct cursor *cur)
 {
        /* Informix accepts DECLARE with variables that are out of scope when OPEN is called.
         * For instance you can DECLARE a cursor in one function, and OPEN/FETCH/CLOSE
@@ -240,132 +240,137 @@ adjust_outofscope_cursor_vars(struct cursor *cur, bool insert)
         * instead of the variable. Do it only for local variables, not for globals.
         */
 
-       struct arguments *list;
-       struct arguments *ptr;
-       struct arguments *newlist = NULL;
-       struct variable *newvar, *newind;
        char *result = make_str("");
+       int insert;
 
-       list = (insert ? cur->argsinsert : cur->argsresult);
-
-       for (ptr = list; ptr != NULL; ptr = ptr->next)
+       for (insert = 1; insert >= 0; insert--)
        {
-               char temp[20]; /* this should be sufficient unless you have 8 byte integers */
-               char *original_var;
-               bool skip_set_var = false;
+               struct arguments *list;
+               struct arguments *ptr;
+               struct arguments *newlist = NULL;
+               struct variable *newvar, *newind;
 
-               /* change variable name to "ECPGget_var(<counter>)" */
-               original_var = ptr->variable->name;
-               sprintf(temp, "%d))", ecpg_internal_var);
+               list = (insert ? cur->argsinsert : cur->argsresult);
 
-               /* Don't emit ECPGset_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)
+               for (ptr = list; ptr != NULL; ptr = ptr->next)
                {
-                       newvar = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)), make_str(" *)(ECPGget_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_internal_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(" *)(ECPGget_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_internal_var++);
-                       else
-                               sprintf(temp, "%d, (", ecpg_internal_var++);
-               }
-               else if (ptr->variable->type->type == ECPGt_struct || ptr->variable->type->type == ECPGt_union)
-               {
-                       sprintf(temp, "%d)))", ecpg_internal_var);
-                       newvar = new_variable(cat_str(4, make_str("(*("), mm_strdup(ptr->variable->type->type_name), make_str(" *)(ECPGget_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_internal_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)
+                       char temp[20];
+                       char *original_var;
+                       bool skip_set_var = false;
+
+                       /* change variable name to "ECPGget_var(<counter>)" */
+                       original_var = ptr->variable->name;
+                       sprintf(temp, "%d))", ecpg_internal_var);
+
+                       /* Don't emit ECPGset_var() calls for global variables */
+                       if (ptr->variable->brace_level == 0)
                        {
-                               sprintf(temp, "%d)))", ecpg_internal_var);
-                               newvar = new_variable(cat_str(4, make_str("(*("), mm_strdup(ptr->variable->type->u.element->type_name), make_str(" *)(ECPGget_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);
+                               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(" *)(ECPGget_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_internal_var++);
                        }
-                       else
+                       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(" *)(ECPGget_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_internal_var++);
+                               newvar = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPGget_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_internal_var++);
+                               else
+                                       sprintf(temp, "%d, (", ecpg_internal_var++);
                        }
-               }
-               else
-               {
-                       newvar = new_variable(cat_str(4, make_str("*("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->lineno), 0);
-                       sprintf(temp, "%d, &(", ecpg_internal_var++);
-               }
-
-               /* create call to "ECPGset_var(<counter>, <pointer>, <line number>)" */
-               if (!skip_set_var)
-                       result = cat_str(5, result, make_str("ECPGset_var("), mm_strdup(temp), mm_strdup(original_var), make_str("), __LINE__);\n"));
-
-               /* now the indicator if there is one and it's not a global variable */
-               if ((ptr->indicator->type->type == ECPGt_NO_INDICATOR) || (ptr->indicator->brace_level == 0))
-               {
-                       newind = ptr->indicator;
-               }
-               else
-               {
-                       /* change variable name to "ECPGget_var(<counter>)" */
-                       original_var = ptr->indicator->name;
-                       sprintf(temp, "%d))", ecpg_internal_var);
-
-                       if (ptr->indicator->type->type == ECPGt_struct || ptr->indicator->type->type == ECPGt_union)
+                       else if (ptr->variable->type->type == ECPGt_struct || ptr->variable->type->type == ECPGt_union)
                        {
                                sprintf(temp, "%d)))", ecpg_internal_var);
-                               newind = new_variable(cat_str(4, make_str("(*("), mm_strdup(ptr->indicator->type->type_name), make_str(" *)(ECPGget_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);
+                               newvar = new_variable(cat_str(4, make_str("(*("), mm_strdup(ptr->variable->type->type_name), make_str(" *)(ECPGget_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_internal_var++);
                        }
-                       else if (ptr->indicator->type->type == ECPGt_array)
+                       else if (ptr->variable->type->type == ECPGt_array)
                        {
-                               if (ptr->indicator->type->u.element->type == ECPGt_struct || ptr->indicator->type->u.element->type == ECPGt_union)
+                               if (ptr->variable->type->u.element->type == ECPGt_struct || ptr->variable->type->u.element->type == ECPGt_union)
                                {
                                        sprintf(temp, "%d)))", ecpg_internal_var);
-                                       newind = new_variable(cat_str(4, make_str("(*("), mm_strdup(ptr->indicator->type->u.element->type_name), make_str(" *)(ECPGget_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);
+                                       newvar = new_variable(cat_str(4, make_str("(*("), mm_strdup(ptr->variable->type->u.element->type_name), make_str(" *)(ECPGget_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_internal_var++);
                                }
                                else
                                {
-                                       newind = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->indicator->type->u.element->type)), make_str(" *)(ECPGget_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);
+                                       newvar = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPGget_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_internal_var++);
                                }
                        }
-                       else if (atoi(ptr->indicator->type->size) > 1)
+                       else
                        {
-                               newind = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->lineno), 0);
-                               sprintf(temp, "%d, (", ecpg_internal_var++);
+                               newvar = new_variable(cat_str(4, make_str("*("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->lineno), 0);
+                               sprintf(temp, "%d, &(", ecpg_internal_var++);
+                       }
+
+                       /* create call to "ECPGset_var(<counter>, <pointer>. <line number>)" */
+                       if (!skip_set_var)
+                               result = cat_str(5, result, make_str("ECPGset_var("), mm_strdup(temp), mm_strdup(original_var), make_str("), __LINE__);\n"));
+
+                       /* now the indicator if there is one and it's not a global variable */
+                       if ((ptr->indicator->type->type == ECPGt_NO_INDICATOR) || (ptr->indicator->brace_level == 0))
+                       {
+                               newind = ptr->indicator;
                        }
                        else
                        {
-                               newind = new_variable(cat_str(4, make_str("*("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->lineno), 0);
-                               sprintf(temp, "%d, &(", ecpg_internal_var++);
+                               /* change variable name to "ECPGget_var(<counter>)" */
+                               original_var = ptr->indicator->name;
+                               sprintf(temp, "%d))", ecpg_internal_var);
+
+                               if (ptr->indicator->type->type == ECPGt_struct || ptr->indicator->type->type == ECPGt_union)
+                               {
+                                       sprintf(temp, "%d)))", ecpg_internal_var);
+                                       newind = new_variable(cat_str(4, make_str("(*("), mm_strdup(ptr->indicator->type->type_name), make_str(" *)(ECPGget_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_internal_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_internal_var);
+                                               newind = new_variable(cat_str(4, make_str("(*("), mm_strdup(ptr->indicator->type->u.element->type_name), make_str(" *)(ECPGget_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_internal_var++);
+                                       }
+                                       else
+                                       {
+                                               newind = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->indicator->type->u.element->type)), make_str(" *)(ECPGget_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_internal_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(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->lineno), 0);
+                                       sprintf(temp, "%d, (", ecpg_internal_var++);
+                               }
+                               else
+                               {
+                                       newind = new_variable(cat_str(4, make_str("*("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->lineno), 0);
+                                       sprintf(temp, "%d, &(", ecpg_internal_var++);
+                               }
+
+                               /* create call to "ECPGset_var(<counter>, <pointer>. <line number>)" */
+                               result = cat_str(5, result, make_str("ECPGset_var("), mm_strdup(temp), mm_strdup(original_var), make_str("), __LINE__);\n"));
                        }
 
-                       /* create call to "ECPGset_var(<counter>, <pointer>, <line number>)" */
-                       result = cat_str(5, result, make_str("ECPGset_var("), mm_strdup(temp), mm_strdup(original_var), make_str("), __LINE__);\n"));
+                       add_variable_to_tail(&newlist, newvar, newind);
                }
 
-               add_variable_to_tail(&newlist, newvar, newind);
+               if (insert)
+                       cur->argsinsert_oos = newlist;
+               else
+                       cur->argsresult_oos = newlist;
        }
 
-       if (insert)
-               cur->argsinsert_oos = newlist;
-       else
-               cur->argsresult_oos = newlist;
-
        return result;
 }
 
index 30af0b068ce3e9f703292f420512d300e6165549..21d4e5d7583f0d453d2b71f9002f0ca19f5f8a9b 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.19 2010/01/26 09:07:31 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.20 2010/01/29 16:28:13 meskes Exp $ */
 
 statements: /*EMPTY*/
                 | statements statement
@@ -332,16 +332,11 @@ ECPGCursorStmt:  DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared
                        comment = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/"));
 
                        if ((braces_open > 0) && INFORMIX_MODE) /* we're in a function */
-                               $$ = cat_str(4,
-                                       adjust_outofscope_cursor_vars(this, true),
-                                       adjust_outofscope_cursor_vars(this, false),
+                               $$ = cat_str(3, adjust_outofscope_cursor_vars(this),
                                        make_str("ECPG_informix_reset_sqlca();"),
                                        comment);
                        else
-                               $$ = cat_str(3,
-                                       adjust_outofscope_cursor_vars(this, true),
-                                       adjust_outofscope_cursor_vars(this, false),
-                                       comment);
+                               $$ = cat2_str(adjust_outofscope_cursor_vars(this), comment);
                }
                ;
 
index 2373475271778a682f628783bdf64bcfb3e69f4e..b61900c9f9f9e3103e868077b76cd895182ec1e8 100644 (file)
@@ -287,9 +287,9 @@ if (sqlca.sqlcode < 0) exit (1);}
        /* Dynamic cursorname test with INTO list in DECLARE stmt */
 
        strcpy(msg, "declare");
-       ECPGset_var( 3, &( curname2 ), __LINE__);\
- ECPGset_var( 1, ( t ), __LINE__);\
- ECPGset_var( 2, &( id ), __LINE__);\
+       ECPGset_var( 1, &( curname2 ), __LINE__);\
+ ECPGset_var( 2, ( t ), __LINE__);\
+ ECPGset_var( 3, &( id ), __LINE__);\
  /* declare $0 cursor for select id , t from t1 */
 #line 100 "cursor.pgc"
 
index de31c65fc6a07c894fa47da266ee83d858699782..aa98ff4ba3e4c175bd1544bbc4b46a39986ef9d0 100644 (file)
@@ -305,25 +305,19 @@ if (sqlca.sqlcode < 0) exit (1);}
 if (sqlca.sqlcode < 0) exit (1);}
 #line 85 "outofscope.pgc"
 
-       { ECPGdo(__LINE__, 0, 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);
+       { ECPGdo(__LINE__, 0, 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 86 "outofscope.pgc"
 
 if (sqlca.sqlcode < 0) exit (1);}
 #line 86 "outofscope.pgc"
 
-       { ECPGdo(__LINE__, 0, 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 87 "outofscope.pgc"
-
-if (sqlca.sqlcode < 0) exit (1);}
-#line 87 "outofscope.pgc"
-
 
        strcpy(msg, "commit");
        { ECPGtrans(__LINE__, NULL, "commit");
-#line 90 "outofscope.pgc"
+#line 89 "outofscope.pgc"
 
 if (sqlca.sqlcode < 0) exit (1);}
-#line 90 "outofscope.pgc"
+#line 89 "outofscope.pgc"
 
 
        /* Test out-of-scope DECLARE/OPEN/FETCH/CLOSE */
@@ -332,7 +326,7 @@ if (sqlca.sqlcode < 0) exit (1);}
        open_cur1();
 
        /* exec sql whenever not found  break ; */
-#line 97 "outofscope.pgc"
+#line 96 "outofscope.pgc"
 
 
        while (1)
@@ -353,26 +347,26 @@ if (sqlca.sqlcode < 0) exit (1);}
 
        strcpy(msg, "drop");
        { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table a1", ECPGt_EOIT, ECPGt_EORT);
-#line 116 "outofscope.pgc"
+#line 115 "outofscope.pgc"
 
 if (sqlca.sqlcode < 0) exit (1);}
-#line 116 "outofscope.pgc"
+#line 115 "outofscope.pgc"
 
 
        strcpy(msg, "commit");
        { ECPGtrans(__LINE__, NULL, "commit");
-#line 119 "outofscope.pgc"
+#line 118 "outofscope.pgc"
 
 if (sqlca.sqlcode < 0) exit (1);}
-#line 119 "outofscope.pgc"
+#line 118 "outofscope.pgc"
 
 
        strcpy(msg, "disconnect"); 
        { ECPGdisconnect(__LINE__, "CURRENT");
-#line 122 "outofscope.pgc"
+#line 121 "outofscope.pgc"
 
 if (sqlca.sqlcode < 0) exit (1);}
-#line 122 "outofscope.pgc"
+#line 121 "outofscope.pgc"
 
 
        return (0);
index c7dccbf1d9e1d7502bb16e87e432d76d4f0ebb06..de44d891b6958ba0c3895c2f022920db5caf9407 100644 (file)
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_execute on line 85: OK: INSERT 0 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 86: 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]: ecpg_execute on line 86: 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 86: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_execute on line 86: OK: INSERT 0 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 87: 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 87: using PQexec
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 87: OK: INSERT 0 1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans on line 90: action "commit"; connection "regress1"
+[NO_PID]: ECPGtrans on line 89: action "commit"; connection "regress1"
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_execute on line 40: query: declare mycur cursor for select * from a1; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_get_data on line 49: RESULT: 3 offset: -1; array: yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 49: RESULT: "a" offset: -1; array: yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 49: RESULT: -1.0 offset: -1; array: yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 49: RESULT: NaN offset: -1; array: yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 49: RESULT: a          offset: -1; array: yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 49: query: fetch mycur; with 0 parameter(s) on connection regress1
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 49: using PQexec
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 49: correctly got 1 tuples with 5 fields
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_get_data on line 49: RESULT: 4 offset: -1; array: yes
-[NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_get_data on line 49: RESULT: b offset: -1; array: yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_get_data on line 49: RESULT: 2.0 offset: -1; array: yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_execute on line 58: OK: CLOSE CURSOR
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 116: query: drop table a1; with 0 parameter(s) on connection regress1
+[NO_PID]: ecpg_execute on line 115: query: drop table a1; with 0 parameter(s) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 116: using PQexec
+[NO_PID]: ecpg_execute on line 115: using PQexec
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 116: OK: DROP TABLE
+[NO_PID]: ecpg_execute on line 115: OK: DROP TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans on line 119: action "commit"; connection "regress1"
+[NO_PID]: ECPGtrans on line 118: 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
index 636d4910dca24d21712e2684c8825094aa6550c9..8c53ad7dfcd64bbd4b295a400491a005b594928a 100644 (file)
@@ -1,4 +1,3 @@
 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         '
+id=3 t='b' d1=2.000000 d2=3.000000 c = 'b         '
index 70fb6a6a1b32a75a54fdf1be228e60b57684ecb3..12cd79ac77a88c0810aa32f3432f45ce466ca42a 100644 (file)
@@ -83,7 +83,6 @@ main (void)
        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");