Re: CommitFest 2009-09, two weeks on - Mailing list pgsql-hackers
From | Boszormenyi Zoltan |
---|---|
Subject | Re: CommitFest 2009-09, two weeks on |
Date | |
Msg-id | 4AC6A268.6090600@cybertec.at Whole thread Raw |
In response to | Re: CommitFest 2009-09, two weeks on (Michael Meskes <meskes@postgresql.org>) |
Responses |
Re: CommitFest 2009-09, two weeks on
Re: CommitFest 2009-09, two weeks on Re: CommitFest 2009-09, two weeks on |
List | pgsql-hackers |
Hi, Michael Meskes írta: > It is accepted either way. I was just pointing out that it might be easier to > review/commit at least parts of your patches if they can be applied seperately. > I have split up (and cleaned up a little) the dynamic cursorname patch into smaller logical, easier-to-review pieces. Descriptions below. 1) 1a-unified-optfromin-fetch-ctxdiff.patch ecpg supports optional FROM/IN in FETCH and MOVE statements (mainly because it's required by Informix-compatibility). Unify core and ecpg grammar as per Tom Lane's suggestion. 2) 1b-cursor_name-ctxdiff.patch "name" -> "cursor_name" transition in core grammar and ecpg grammar. Currently it does nothing, it's a preparation phase. Depends on patch 1. 3) 1c-remove-var-from-list.patch Introduce function remove_variable_from_list(). It is used by the dynamic cursor, SQLDA and DESCRIBE patches for different reasons. Applicable separately. 4) 1d-dynamiccur-ctxdiff.patch The real point of the whole series in this email. Extend "cursor_name" in the ecpg grammar to actually accept a character variable. The cursorname-as-variable is replaced in the final SQL script with a $0 placeholder. Doesn't compile as-is, requires patch 5 to get the two shift/reduce conflicts fixed. Depends on patches 1, 2 and 3. 5) 1e-fix-shiftreduce-ctxdiff.patch De-factorize "BACKWARD opt_from_in cursor_name" and "FORWARD opt_from_in cursor_name" out of fetch_args and pull them up into FetchStmt in the ecpg grammar. Depends on patch 4. One line in parse.pl is not clear for me: $replace_line{'fetch_args'} = 'ignore'; The genarated preproc.y is the same with or without this line. But as the previous version had it with "fetch_direction", I left it in. 6) 1f-cursorname-in-varchar-ctxdiff.patch Allow that varchar can be used as cursorname as well. Other character variable types were already supported. Depends on patch 4. 7) 1g-regressiontests-ctxdiff.patch Introduce cursor.pgc regression test for both native and compat mode. Depends on all patches. 8) 1h-fix-parse.pl-ctxdiff.patch Now useless patch, in the previous dynamic cursorname patch the following scenario occured: the same rule had both an "addon" and a "rule" extension. Without this fix, the following code was generated in preproc.y: ruleA: <accepted syntax> { <addon code block> { <automatic code block> } With the cleanup I did during this splitup, this scenario doesn't happen, but this fix may be considered useful. Applicable separately. After every patch (except 4) both the core and ecpg "make check" are successful. Best regards, Zoltán Böszörményi -- Bible has answers for everything. Proof: "But let your communication be, Yea, yea; Nay, nay: for whatsoever is more than these cometh of evil." (Matthew 5:37) - basics of digital technology. "May your kingdom come" - superficial description of plate tectonics ---------------------------------- Zoltán Böszörményi Cybertec Schönig & Schönig GmbH http://www.postgresql.at/ diff -dcrpN pgsql.orig/src/backend/parser/gram.y pgsql.ufd-opt-fromin-fetch/src/backend/parser/gram.y *** pgsql.orig/src/backend/parser/gram.y 2009-09-23 19:25:40.000000000 +0200 --- pgsql.ufd-opt-fromin-fetch/src/backend/parser/gram.y 2009-10-02 23:57:32.000000000 +0200 *************** static TypeName *TableFuncTypeName(List *** 330,336 **** %type <ival> opt_column event cursor_options opt_hold opt_set_data %type <objtype> reindex_type drop_type comment_type ! %type <node> fetch_direction limit_clause select_limit_value offset_clause select_offset_value select_offset_value2 opt_select_fetch_first_value %type <ival> row_or_rows first_or_next --- 330,336 ---- %type <ival> opt_column event cursor_options opt_hold opt_set_data %type <objtype> reindex_type drop_type comment_type ! %type <node> fetch_args limit_clause select_limit_value offset_clause select_offset_value select_offset_value2 opt_select_fetch_first_value %type <ival> row_or_rows first_or_next *************** comment_text: *** 4137,4278 **** * *****************************************************************************/ ! FetchStmt: FETCH fetch_direction from_in name { FetchStmt *n = (FetchStmt *) $2; - n->portalname = $4; - n->ismove = FALSE; - $$ = (Node *)n; - } - | FETCH name - { - FetchStmt *n = makeNode(FetchStmt); - n->direction = FETCH_FORWARD; - n->howMany = 1; - n->portalname = $2; n->ismove = FALSE; $$ = (Node *)n; } ! | MOVE fetch_direction from_in name { FetchStmt *n = (FetchStmt *) $2; - n->portalname = $4; n->ismove = TRUE; $$ = (Node *)n; } ! | MOVE name { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_FORWARD; n->howMany = 1; - n->portalname = $2; - n->ismove = TRUE; $$ = (Node *)n; } ! ; ! ! fetch_direction: ! /*EMPTY*/ { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_FORWARD; n->howMany = 1; $$ = (Node *)n; } ! | NEXT { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_FORWARD; n->howMany = 1; $$ = (Node *)n; } ! | PRIOR { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_BACKWARD; n->howMany = 1; $$ = (Node *)n; } ! | FIRST_P { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_ABSOLUTE; n->howMany = 1; $$ = (Node *)n; } ! | LAST_P { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_ABSOLUTE; n->howMany = -1; $$ = (Node *)n; } ! | ABSOLUTE_P SignedIconst { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_ABSOLUTE; n->howMany = $2; $$ = (Node *)n; } ! | RELATIVE_P SignedIconst { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_RELATIVE; n->howMany = $2; $$ = (Node *)n; } ! | SignedIconst { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_FORWARD; n->howMany = $1; $$ = (Node *)n; } ! | ALL { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_FORWARD; n->howMany = FETCH_ALL; $$ = (Node *)n; } ! | FORWARD { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_FORWARD; n->howMany = 1; $$ = (Node *)n; } ! | FORWARD SignedIconst { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_FORWARD; n->howMany = $2; $$ = (Node *)n; } ! | FORWARD ALL { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_FORWARD; n->howMany = FETCH_ALL; $$ = (Node *)n; } ! | BACKWARD { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_BACKWARD; n->howMany = 1; $$ = (Node *)n; } ! | BACKWARD SignedIconst { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_BACKWARD; n->howMany = $2; $$ = (Node *)n; } ! | BACKWARD ALL { FetchStmt *n = makeNode(FetchStmt); n->direction = FETCH_BACKWARD; n->howMany = FETCH_ALL; $$ = (Node *)n; --- 4137,4280 ---- * *****************************************************************************/ ! FetchStmt: FETCH fetch_args { FetchStmt *n = (FetchStmt *) $2; n->ismove = FALSE; $$ = (Node *)n; } ! | MOVE fetch_args { FetchStmt *n = (FetchStmt *) $2; n->ismove = TRUE; $$ = (Node *)n; } ! ; ! ! fetch_args: name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $1; n->direction = FETCH_FORWARD; n->howMany = 1; $$ = (Node *)n; } ! | from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $2; n->direction = FETCH_FORWARD; n->howMany = 1; $$ = (Node *)n; } ! | NEXT opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $3; n->direction = FETCH_FORWARD; n->howMany = 1; $$ = (Node *)n; } ! | PRIOR opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $3; n->direction = FETCH_BACKWARD; n->howMany = 1; $$ = (Node *)n; } ! | FIRST_P opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $3; n->direction = FETCH_ABSOLUTE; n->howMany = 1; $$ = (Node *)n; } ! | LAST_P opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $3; n->direction = FETCH_ABSOLUTE; n->howMany = -1; $$ = (Node *)n; } ! | ABSOLUTE_P SignedIconst opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $4; n->direction = FETCH_ABSOLUTE; n->howMany = $2; $$ = (Node *)n; } ! | RELATIVE_P SignedIconst opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $4; n->direction = FETCH_RELATIVE; n->howMany = $2; $$ = (Node *)n; } ! | SignedIconst opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $3; n->direction = FETCH_FORWARD; n->howMany = $1; $$ = (Node *)n; } ! | ALL opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $3; n->direction = FETCH_FORWARD; n->howMany = FETCH_ALL; $$ = (Node *)n; } ! | FORWARD opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $3; n->direction = FETCH_FORWARD; n->howMany = 1; $$ = (Node *)n; } ! | FORWARD SignedIconst opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $4; n->direction = FETCH_FORWARD; n->howMany = $2; $$ = (Node *)n; } ! | FORWARD ALL opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $4; n->direction = FETCH_FORWARD; n->howMany = FETCH_ALL; $$ = (Node *)n; } ! | BACKWARD opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $3; n->direction = FETCH_BACKWARD; n->howMany = 1; $$ = (Node *)n; } ! | BACKWARD SignedIconst opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $4; n->direction = FETCH_BACKWARD; n->howMany = $2; $$ = (Node *)n; } ! | BACKWARD ALL opt_from_in name { FetchStmt *n = makeNode(FetchStmt); + n->portalname = $4; n->direction = FETCH_BACKWARD; n->howMany = FETCH_ALL; $$ = (Node *)n; *************** from_in: FROM {} *** 4283,4288 **** --- 4285,4295 ---- | IN_P {} ; + opt_from_in: FROM {} + | IN_P {} + | /* EMPTY */ {} + ; + /***************************************************************************** * diff -dcrpN pgsql.orig/src/interfaces/ecpg/preproc/ecpg.addons pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/preproc/ecpg.addons *** pgsql.orig/src/interfaces/ecpg/preproc/ecpg.addons 2009-08-14 16:27:41.000000000 +0200 --- pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 00:50:37.000000000 +0200 *************** ECPG: ConstraintAttributeSpecConstraintT *** 206,221 **** if (strcmp($2, "deferrable") != 0 && strcmp($1, "initially deferrable") == 0 ) mmerror(PARSE_ERROR, ET_ERROR, "constraint declared INITIALLY DEFERRED must be DEFERRABLE"); ECPG: var_valueNumericOnly addon - ECPG: fetch_directionSignedIconst addon if ($1[0] == '$') { free($1); $1 = make_str("$0"); } ! ECPG: fetch_directionABSOLUTE_PSignedIconst addon ! ECPG: fetch_directionRELATIVE_PSignedIconst addon ! ECPG: fetch_directionFORWARDSignedIconst addon ! ECPG: fetch_directionBACKWARDSignedIconst addon if ($2[0] == '$') { free($2); --- 206,241 ---- if (strcmp($2, "deferrable") != 0 && strcmp($1, "initially deferrable") == 0 ) mmerror(PARSE_ERROR, ET_ERROR, "constraint declared INITIALLY DEFERRED must be DEFERRABLE"); ECPG: var_valueNumericOnly addon if ($1[0] == '$') { free($1); $1 = make_str("$0"); } ! ECPG: fetch_argsname addon ! add_additional_variables($1, false); ! ECPG: fetch_argsfrom_inname addon ! add_additional_variables($2, false); ! ECPG: fetch_argsNEXTopt_from_inname addon ! ECPG: fetch_argsPRIORopt_from_inname addon ! ECPG: fetch_argsFIRST_Popt_from_inname addon ! ECPG: fetch_argsLAST_Popt_from_inname addon ! ECPG: fetch_argsALLopt_from_inname addon ! add_additional_variables($3, false); ! ECPG: fetch_argsSignedIconstopt_from_inname addon ! add_additional_variables($3, false); ! if ($1[0] == '$') ! { ! free($1); ! $1 = make_str("$0"); ! } ! ECPG: fetch_argsFORWARDALLopt_from_inname addon ! ECPG: fetch_argsBACKWARDALLopt_from_inname addon ! add_additional_variables($4, false); ! ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_inname addon ! ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_inname addon ! ECPG: fetch_argsFORWARDSignedIconstopt_from_inname addon ! ECPG: fetch_argsBACKWARDSignedIconstopt_from_inname addon ! add_additional_variables($4, false); if ($2[0] == '$') { free($2); *************** ECPG: VariableShowStmtSHOWALL block *** 336,382 **** mmerror(PARSE_ERROR, ET_ERROR, "SHOW ALL is not implemented"); $$ = EMPTY; } ! ECPG: FetchStmtFETCHfetch_directionfrom_inname block ! { ! add_additional_variables($4, false); ! $$ = cat_str(4, make_str("fetch"), $2, $3, $4); ! } ! ECPG: FetchStmtFETCHname block { ! add_additional_variables($2, false); ! $$ = cat_str(2, make_str("fetch"), $2); } - ECPG: FetchStmtMOVEname rule - | FETCH fetch_direction from_in name ecpg_into - { - add_additional_variables($4, false); - $$ = cat_str(4, make_str("fetch"), $2, $3, $4); - } - | FETCH fetch_direction name ecpg_into - { - add_additional_variables($3, false); - $$ = cat_str(4, make_str("fetch"), $2, make_str("from"), $3); - } - | FETCH from_in name ecpg_into - { - add_additional_variables($3, false); - $$ = cat_str(3, make_str("fetch"), $2, $3); - } - | FETCH name ecpg_into - { - add_additional_variables($2, false); - $$ = cat2_str(make_str("fetch"), $2); - } - | FETCH fetch_direction name - { - add_additional_variables($3, false); - $$ = cat_str(4, make_str("fetch"), $2, make_str("from"), $3); - } - | FETCH from_in name - { - add_additional_variables($3, false); - $$ = cat_str(3, make_str("fetch"), $2, $3); - } ECPG: SpecialRuleRelationOLD addon if (!QueryIsRule) mmerror(PARSE_ERROR, ET_ERROR, "OLD used in query that is not in a rule"); --- 356,366 ---- mmerror(PARSE_ERROR, ET_ERROR, "SHOW ALL is not implemented"); $$ = EMPTY; } ! ECPG: FetchStmtMOVEfetch_args rule ! | FETCH fetch_args ecpg_into { ! $$ = cat2_str(make_str("fetch"), $2); } ECPG: SpecialRuleRelationOLD addon if (!QueryIsRule) mmerror(PARSE_ERROR, ET_ERROR, "OLD used in query that is not in a rule"); diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c *** pgsql.orig/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c 2009-08-14 16:27:41.000000000 +0200 --- pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/test/expected/compat_informix-test_informix.c 2009-10-03 00:33:14.000000000+0200 *************** if (sqlca.sqlcode < 0) dosqlprint ( );} *** 158,164 **** while (1) { ! { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch forward from c", ECPGt_EOIT, ECPGt_int,&(i),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal), --- 158,164 ---- while (1) { ! { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch forward c", ECPGt_EOIT, ECPGt_int,&(i),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal), diff -dcrpN pgsql.orig/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr *** pgsql.orig/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr 2009-08-14 16:27:41.000000000 +0200 --- pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr 2009-10-03 00:33:15.000000000+0200 *************** DETAIL: Key (i)=(7) already exists. *** 63,69 **** [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 95: OK: DECLARE CURSOR [NO_PID]: sqlca: code: 0, state: 00000 ! [NO_PID]: ecpg_execute on line 57: query: fetch forward from c; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 57: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 --- 63,69 ---- [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 95: OK: DECLARE CURSOR [NO_PID]: sqlca: code: 0, state: 00000 ! [NO_PID]: ecpg_execute on line 57: query: fetch forward c; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 57: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 *************** DETAIL: Key (i)=(7) already exists. *** 75,81 **** [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 57: RESULT: test offset: -1; array: yes [NO_PID]: sqlca: code: 0, state: 00000 ! [NO_PID]: ecpg_execute on line 57: query: fetch forward from c; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 57: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 --- 75,81 ---- [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 57: RESULT: test offset: -1; array: yes [NO_PID]: sqlca: code: 0, state: 00000 ! [NO_PID]: ecpg_execute on line 57: query: fetch forward c; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 57: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 *************** DETAIL: Key (i)=(7) already exists. *** 87,93 **** [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 57: RESULT: a offset: -1; array: yes [NO_PID]: sqlca: code: 0, state: 00000 ! [NO_PID]: ecpg_execute on line 57: query: fetch forward from c; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 57: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 --- 87,93 ---- [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_get_data on line 57: RESULT: a offset: -1; array: yes [NO_PID]: sqlca: code: 0, state: 00000 ! [NO_PID]: ecpg_execute on line 57: query: fetch forward c; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 57: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 diff -dcrpN pgsql.ufd-opt-fromin-fetch/src/backend/parser/gram.y pgsql.cursor_name/src/backend/parser/gram.y *** pgsql.ufd-opt-fromin-fetch/src/backend/parser/gram.y 2009-10-02 23:57:32.000000000 +0200 --- pgsql.cursor_name/src/backend/parser/gram.y 2009-10-03 00:47:53.000000000 +0200 *************** static TypeName *TableFuncTypeName(List *** 252,258 **** %type <str> relation_name copy_file_name database_name access_method_clause access_method attr_name ! index_name name file_name cluster_index_specification %type <list> func_name handler_name qual_Op qual_all_Op subquery_Op opt_class opt_inline_handler opt_validator validator_clause --- 252,258 ---- %type <str> relation_name copy_file_name database_name access_method_clause access_method attr_name ! index_name name cursor_name file_name cluster_index_specification %type <list> func_name handler_name qual_Op qual_all_Op subquery_Op opt_class opt_inline_handler opt_validator validator_clause *************** reloption_elem: *** 1920,1926 **** *****************************************************************************/ ClosePortalStmt: ! CLOSE name { ClosePortalStmt *n = makeNode(ClosePortalStmt); n->portalname = $2; --- 1920,1926 ---- *****************************************************************************/ ClosePortalStmt: ! CLOSE cursor_name { ClosePortalStmt *n = makeNode(ClosePortalStmt); n->portalname = $2; *************** FetchStmt: FETCH fetch_args *** 4151,4157 **** } ; ! fetch_args: name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $1; --- 4151,4157 ---- } ; ! fetch_args: cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $1; *************** fetch_args: name *** 4159,4165 **** n->howMany = 1; $$ = (Node *)n; } ! | from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $2; --- 4159,4165 ---- n->howMany = 1; $$ = (Node *)n; } ! | from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $2; *************** fetch_args: name *** 4167,4173 **** n->howMany = 1; $$ = (Node *)n; } ! | NEXT opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; --- 4167,4173 ---- n->howMany = 1; $$ = (Node *)n; } ! | NEXT opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; *************** fetch_args: name *** 4175,4181 **** n->howMany = 1; $$ = (Node *)n; } ! | PRIOR opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; --- 4175,4181 ---- n->howMany = 1; $$ = (Node *)n; } ! | PRIOR opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; *************** fetch_args: name *** 4183,4189 **** n->howMany = 1; $$ = (Node *)n; } ! | FIRST_P opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; --- 4183,4189 ---- n->howMany = 1; $$ = (Node *)n; } ! | FIRST_P opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; *************** fetch_args: name *** 4191,4197 **** n->howMany = 1; $$ = (Node *)n; } ! | LAST_P opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; --- 4191,4197 ---- n->howMany = 1; $$ = (Node *)n; } ! | LAST_P opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; *************** fetch_args: name *** 4199,4205 **** n->howMany = -1; $$ = (Node *)n; } ! | ABSOLUTE_P SignedIconst opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $4; --- 4199,4205 ---- n->howMany = -1; $$ = (Node *)n; } ! | ABSOLUTE_P SignedIconst opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $4; *************** fetch_args: name *** 4207,4213 **** n->howMany = $2; $$ = (Node *)n; } ! | RELATIVE_P SignedIconst opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $4; --- 4207,4213 ---- n->howMany = $2; $$ = (Node *)n; } ! | RELATIVE_P SignedIconst opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $4; *************** fetch_args: name *** 4215,4221 **** n->howMany = $2; $$ = (Node *)n; } ! | SignedIconst opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; --- 4215,4221 ---- n->howMany = $2; $$ = (Node *)n; } ! | SignedIconst opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; *************** fetch_args: name *** 4223,4229 **** n->howMany = $1; $$ = (Node *)n; } ! | ALL opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; --- 4223,4229 ---- n->howMany = $1; $$ = (Node *)n; } ! | ALL opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; *************** fetch_args: name *** 4231,4237 **** n->howMany = FETCH_ALL; $$ = (Node *)n; } ! | FORWARD opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; --- 4231,4237 ---- n->howMany = FETCH_ALL; $$ = (Node *)n; } ! | FORWARD opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; *************** fetch_args: name *** 4239,4245 **** n->howMany = 1; $$ = (Node *)n; } ! | FORWARD SignedIconst opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $4; --- 4239,4245 ---- n->howMany = 1; $$ = (Node *)n; } ! | FORWARD SignedIconst opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $4; *************** fetch_args: name *** 4247,4253 **** n->howMany = $2; $$ = (Node *)n; } ! | FORWARD ALL opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $4; --- 4247,4253 ---- n->howMany = $2; $$ = (Node *)n; } ! | FORWARD ALL opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $4; *************** fetch_args: name *** 4255,4261 **** n->howMany = FETCH_ALL; $$ = (Node *)n; } ! | BACKWARD opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; --- 4255,4261 ---- n->howMany = FETCH_ALL; $$ = (Node *)n; } ! | BACKWARD opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $3; *************** fetch_args: name *** 4263,4269 **** n->howMany = 1; $$ = (Node *)n; } ! | BACKWARD SignedIconst opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $4; --- 4263,4269 ---- n->howMany = 1; $$ = (Node *)n; } ! | BACKWARD SignedIconst opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $4; *************** fetch_args: name *** 4271,4277 **** n->howMany = $2; $$ = (Node *)n; } ! | BACKWARD ALL opt_from_in name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $4; --- 4271,4277 ---- n->howMany = $2; $$ = (Node *)n; } ! | BACKWARD ALL opt_from_in cursor_name { FetchStmt *n = makeNode(FetchStmt); n->portalname = $4; *************** set_target_list: *** 6941,6947 **** * CURSOR STATEMENTS * *****************************************************************************/ ! DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt { DeclareCursorStmt *n = makeNode(DeclareCursorStmt); n->portalname = $2; --- 6941,6947 ---- * CURSOR STATEMENTS * *****************************************************************************/ ! DeclareCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR SelectStmt { DeclareCursorStmt *n = makeNode(DeclareCursorStmt); n->portalname = $2; *************** DeclareCursorStmt: DECLARE name cursor_o *** 6952,6957 **** --- 6952,6960 ---- } ; + cursor_name: name { $$ = $1; } + ; + cursor_options: /*EMPTY*/ { $$ = 0; } | cursor_options NO SCROLL { $$ = $1 | CURSOR_OPT_NO_SCROLL; } | cursor_options SCROLL { $$ = $1 | CURSOR_OPT_SCROLL; } diff -dcrpN pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/preproc/ecpg.addons pgsql.cursor_name/src/interfaces/ecpg/preproc/ecpg.addons *** pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 00:50:37.000000000 +0200 --- pgsql.cursor_name/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 00:51:58.000000000 +0200 *************** ECPG: var_valueNumericOnly addon *** 211,240 **** free($1); $1 = make_str("$0"); } ! ECPG: fetch_argsname addon add_additional_variables($1, false); ! ECPG: fetch_argsfrom_inname addon add_additional_variables($2, false); ! ECPG: fetch_argsNEXTopt_from_inname addon ! ECPG: fetch_argsPRIORopt_from_inname addon ! ECPG: fetch_argsFIRST_Popt_from_inname addon ! ECPG: fetch_argsLAST_Popt_from_inname addon ! ECPG: fetch_argsALLopt_from_inname addon add_additional_variables($3, false); ! ECPG: fetch_argsSignedIconstopt_from_inname addon add_additional_variables($3, false); if ($1[0] == '$') { free($1); $1 = make_str("$0"); } ! ECPG: fetch_argsFORWARDALLopt_from_inname addon ! ECPG: fetch_argsBACKWARDALLopt_from_inname addon add_additional_variables($4, false); ! ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_inname addon ! ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_inname addon ! ECPG: fetch_argsFORWARDSignedIconstopt_from_inname addon ! ECPG: fetch_argsBACKWARDSignedIconstopt_from_inname addon add_additional_variables($4, false); if ($2[0] == '$') { --- 211,240 ---- free($1); $1 = make_str("$0"); } ! ECPG: fetch_argscursor_name addon add_additional_variables($1, false); ! ECPG: fetch_argsfrom_incursor_name addon add_additional_variables($2, false); ! ECPG: fetch_argsNEXTopt_from_incursor_name addon ! ECPG: fetch_argsPRIORopt_from_incursor_name addon ! ECPG: fetch_argsFIRST_Popt_from_incursor_name addon ! ECPG: fetch_argsLAST_Popt_from_incursor_name addon ! ECPG: fetch_argsALLopt_from_incursor_name addon add_additional_variables($3, false); ! ECPG: fetch_argsSignedIconstopt_from_incursor_name addon add_additional_variables($3, false); if ($1[0] == '$') { free($1); $1 = make_str("$0"); } ! ECPG: fetch_argsFORWARDALLopt_from_incursor_name addon ! ECPG: fetch_argsBACKWARDALLopt_from_incursor_name addon add_additional_variables($4, false); ! ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_incursor_name addon ! ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_incursor_name addon ! ECPG: fetch_argsFORWARDSignedIconstopt_from_incursor_name addon ! ECPG: fetch_argsBACKWARDSignedIconstopt_from_incursor_name addon add_additional_variables($4, false); if ($2[0] == '$') { *************** ECPG: PrepareStmtPREPAREprepared_namepre *** 255,261 **** } ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block { $$ = $2; } ! ECPG: DeclareCursorStmtDECLAREnamecursor_optionsCURSORopt_holdFORSelectStmt block { struct cursor *ptr, *this; char *comment; --- 255,261 ---- } ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block { $$ = $2; } ! ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectStmt block { struct cursor *ptr, *this; char *comment; diff -dcrpN pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/preproc/ecpg.trailer pgsql.cursor_name/src/interfaces/ecpg/preproc/ecpg.trailer *** pgsql.ufd-opt-fromin-fetch/src/interfaces/ecpg/preproc/ecpg.trailer 2009-09-23 19:25:46.000000000 +0200 --- pgsql.cursor_name/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 00:55:00.000000000 +0200 *************** prepared_name: name { *** 285,291 **** * Declare a prepared cursor. The syntax is different from the standard * declare statement, so we create a new rule. */ ! ECPGCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR prepared_name { struct cursor *ptr, *this; struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable)); --- 285,291 ---- * Declare a prepared cursor. The syntax is different from the standard * declare statement, so we create a new rule. */ ! ECPGCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared_name { struct cursor *ptr, *this; struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable)); *************** ECPGFree: SQL_FREE name { $$ = $2; } *** 957,963 **** /* * open is an open cursor, at the moment this has to be removed */ ! ECPGOpen: SQL_OPEN name opt_ecpg_using { $$ = $2; }; opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; } | ecpg_using { $$ = $1; } --- 957,963 ---- /* * open is an open cursor, at the moment this has to be removed */ ! ECPGOpen: SQL_OPEN cursor_name opt_ecpg_using { $$ = $2; }; opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; } | ecpg_using { $$ = $1; } diff -dcrpN pgsql.cursor_name/src/interfaces/ecpg/preproc/extern.h pgsql.removevarlist/src/interfaces/ecpg/preproc/extern.h *** pgsql.cursor_name/src/interfaces/ecpg/preproc/extern.h 2009-09-08 10:12:40.000000000 +0200 --- pgsql.removevarlist/src/interfaces/ecpg/preproc/extern.h 2009-10-03 01:07:54.000000000 +0200 *************** extern struct descriptor *lookup_descrip *** 90,95 **** --- 90,96 ---- extern struct variable *descriptor_variable(const char *name, int input); extern void add_variable_to_head(struct arguments **, struct variable *, struct variable *); extern void add_variable_to_tail(struct arguments **, struct variable *, struct variable *); + extern void remove_variable_from_list(struct arguments ** list, struct variable * var); extern void dump_variables(struct arguments *, int); extern struct typedefs *get_typedef(char *); extern void adjust_array(enum ECPGttype, char **, char **, char *, char *, int, bool); diff -dcrpN pgsql.cursor_name/src/interfaces/ecpg/preproc/variable.c pgsql.removevarlist/src/interfaces/ecpg/preproc/variable.c *** pgsql.cursor_name/src/interfaces/ecpg/preproc/variable.c 2009-08-07 13:06:28.000000000 +0200 --- pgsql.removevarlist/src/interfaces/ecpg/preproc/variable.c 2009-10-03 01:09:32.000000000 +0200 *************** add_variable_to_tail(struct arguments ** *** 401,406 **** --- 401,430 ---- *list = new; } + void + remove_variable_from_list(struct arguments ** list, struct variable * var) + { + struct arguments *p, *prev = NULL; + bool found = false; + + for (p = *list; p; p = p->next) + { + if (p->variable == var) + { + found = true; + break; + } + prev = p; + } + if (found) + { + if (prev) + prev->next = p->next; + else + *list = p->next; + } + } + /* Dump out a list of all the variable on this list. This is a recursive function that works from the end of the list and deletes the list as we go on. diff -dcrpN pgsql.removevarlist/src/interfaces/ecpg/preproc/ecpg.addons pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.addons *** pgsql.removevarlist/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 00:51:58.000000000 +0200 --- pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 01:24:46.000000000 +0200 *************** ECPG: var_valueNumericOnly addon *** 213,228 **** --- 213,248 ---- } ECPG: fetch_argscursor_name addon add_additional_variables($1, false); + if ($1[0] == ':') + { + free($1); + $1 = make_str("$0"); + } ECPG: fetch_argsfrom_incursor_name addon add_additional_variables($2, false); + if ($2[0] == ':') + { + free($2); + $2 = make_str("$0"); + } ECPG: fetch_argsNEXTopt_from_incursor_name addon ECPG: fetch_argsPRIORopt_from_incursor_name addon ECPG: fetch_argsFIRST_Popt_from_incursor_name addon ECPG: fetch_argsLAST_Popt_from_incursor_name addon ECPG: fetch_argsALLopt_from_incursor_name addon add_additional_variables($3, false); + if ($3[0] == ':') + { + free($3); + $3 = make_str("$0"); + } ECPG: fetch_argsSignedIconstopt_from_incursor_name addon add_additional_variables($3, false); + if ($3[0] == ':') + { + free($3); + $3 = make_str("$0"); + } if ($1[0] == '$') { free($1); *************** ECPG: fetch_argsSignedIconstopt_from_inc *** 231,246 **** --- 251,285 ---- ECPG: fetch_argsFORWARDALLopt_from_incursor_name addon ECPG: fetch_argsBACKWARDALLopt_from_incursor_name addon add_additional_variables($4, false); + if ($4[0] == ':') + { + free($4); + $4 = make_str("$0"); + } ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_incursor_name addon ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_incursor_name addon ECPG: fetch_argsFORWARDSignedIconstopt_from_incursor_name addon ECPG: fetch_argsBACKWARDSignedIconstopt_from_incursor_name addon add_additional_variables($4, false); + if ($4[0] == ':') + { + free($4); + $4 = make_str("$0"); + } if ($2[0] == '$') { free($2); $2 = make_str("$0"); } + ECPG: cursor_namename rule + | char_civar + { + char *curname = mm_alloc(strlen($1) + 2); + sprintf(curname, ":%s", $1); + free($1); + $1 = curname; + $$ = $1; + } ECPG: PrepareStmtPREPAREprepared_nameprep_type_clauseASPreparableStmt block { $$.name = $2; *************** ECPG: ExecuteStmtEXECUTEprepared_nameexe *** 258,263 **** --- 297,303 ---- ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectStmt block { struct cursor *ptr, *this; + char *cursor_marker = $2[0] == ':' ? make_str("$0") : mm_strdup($2); char *comment; for (ptr = cur; ptr != NULL; ptr = ptr->next) *************** ECPG: DeclareCursorStmtDECLAREcursor_nam *** 272,278 **** this->name = $2; this->connection = connection; this->opened = false; ! this->command = cat_str(7, make_str("declare"), mm_strdup($2), $3, make_str("cursor"), $5, make_str("for"), $7); this->argsinsert = argsinsert; this->argsresult = argsresult; argsinsert = argsresult = NULL; --- 312,318 ---- this->name = $2; 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->argsresult = argsresult; argsinsert = argsresult = NULL; *************** ECPG: DeclareCursorStmtDECLAREcursor_nam *** 292,297 **** --- 332,342 ---- else $$ = comment; } + ECPG: ClosePortalStmtCLOSEcursor_name block + { + char *cursor_marker = $2[0] == ':' ? make_str("$0") : $2; + $$ = cat2_str(make_str("close"), cursor_marker); + } ECPG: opt_hold block { if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit == true) diff -dcrpN pgsql.removevarlist/src/interfaces/ecpg/preproc/ecpg.trailer pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.trailer *** pgsql.removevarlist/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 00:55:00.000000000 +0200 --- pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 01:36:36.000000000 +0200 *************** prepared_name: name { *** 288,293 **** --- 288,294 ---- ECPGCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared_name { struct cursor *ptr, *this; + 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"; *************** ECPGCursorStmt: DECLARE cursor_name cur *** 304,310 **** this->next = cur; this->name = $2; this->connection = connection; ! this->command = cat_str(6, make_str("declare"), mm_strdup($2), $3, make_str("cursor"), $5, make_str("for $1")); this->argsresult = NULL; thisquery->type = &ecpg_query; --- 305,311 ---- this->next = cur; this->name = $2; 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; thisquery->type = &ecpg_query; *************** ECPGCursorStmt: DECLARE cursor_name cur *** 314,319 **** --- 315,326 ---- sprintf(thisquery->name, "ECPGprepared_statement(%s, %s, __LINE__)", con, $7); this->argsinsert = NULL; + if ($2[0] == ':') + { + struct variable *var = find_variable($2 + 1); + remove_variable_from_list(&argsinsert, var); + add_variable_to_head(&(this->argsinsert), var, &no_indicator); + } add_variable_to_head(&(this->argsinsert), thisquery, &no_indicator); cur = this; *************** ECPGFree: SQL_FREE name { $$ = $2; } *** 957,963 **** /* * open is an open cursor, at the moment this has to be removed */ ! ECPGOpen: SQL_OPEN cursor_name opt_ecpg_using { $$ = $2; }; opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; } | ecpg_using { $$ = $1; } --- 964,979 ---- /* * open is an open cursor, at the moment this has to be removed */ ! ECPGOpen: SQL_OPEN cursor_name opt_ecpg_using ! { ! if ($2[0] == ':') ! { ! struct variable *var = find_variable($2 + 1); ! remove_variable_from_list(&argsinsert, var); ! } ! $$ = $2; ! } ! ; opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; } | ecpg_using { $$ = $1; } *************** civarind: cvariable indicator *** 1782,1787 **** --- 1798,1810 ---- } ; + char_civar: char_variable + { + add_variable_to_head(&argsinsert, find_variable($1), &no_indicator); + $$ = $1; + } + ; + civar: cvariable { add_variable_to_head(&argsinsert, find_variable($1), &no_indicator); diff -dcrpN pgsql.removevarlist/src/interfaces/ecpg/preproc/ecpg.type pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.type *** pgsql.removevarlist/src/interfaces/ecpg/preproc/ecpg.type 2008-11-14 11:03:33.000000000 +0100 --- pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.type 2009-10-03 01:36:11.000000000 +0200 *************** *** 43,48 **** --- 43,49 ---- %type <str> c_term %type <str> c_thing %type <str> char_variable + %type <str> char_civar %type <str> civar %type <str> civarind %type <str> ColLabel diff -dcrpN pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.addons pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.addons *** pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 01:24:46.000000000 +0200 --- pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.addons 2009-10-03 01:54:43.000000000 +0200 *************** ECPG: FetchStmtMOVEfetch_args rule *** 406,411 **** --- 406,459 ---- { $$ = cat2_str(make_str("fetch"), $2); } + | FETCH FORWARD cursor_name opt_ecpg_into + { + char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3; + add_additional_variables($3, false); + $$ = cat_str(2, make_str("fetch forward"), cursor_marker); + } + | FETCH FORWARD from_in cursor_name opt_ecpg_into + { + char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4; + add_additional_variables($4, false); + $$ = cat_str(2, make_str("fetch forward from"), cursor_marker); + } + | FETCH BACKWARD cursor_name opt_ecpg_into + { + char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3; + add_additional_variables($3, false); + $$ = cat_str(2, make_str("fetch backward"), cursor_marker); + } + | FETCH BACKWARD from_in cursor_name opt_ecpg_into + { + char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4; + add_additional_variables($4, false); + $$ = cat_str(2, make_str("fetch backward from"), cursor_marker); + } + | MOVE FORWARD cursor_name + { + char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3; + add_additional_variables($3, false); + $$ = cat_str(2, make_str("move forward"), cursor_marker); + } + | MOVE FORWARD from_in cursor_name + { + char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4; + add_additional_variables($4, false); + $$ = cat_str(2, make_str("move forward from"), cursor_marker); + } + | MOVE BACKWARD cursor_name + { + char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3; + add_additional_variables($3, false); + $$ = cat_str(2, make_str("move backward"), cursor_marker); + } + | MOVE BACKWARD from_in cursor_name + { + char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4; + add_additional_variables($4, false); + $$ = cat_str(2, make_str("move backward from"), cursor_marker); + } ECPG: SpecialRuleRelationOLD addon if (!QueryIsRule) mmerror(PARSE_ERROR, ET_ERROR, "OLD used in query that is not in a rule"); diff -dcrpN pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.trailer pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.trailer *** pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 01:36:36.000000000 +0200 --- pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 01:42:17.000000000 +0200 *************** ecpg_into: INTO into_list { $$ = EMPTY; *** 2020,2025 **** --- 2020,2029 ---- | into_descriptor { $$ = $1; } ; + opt_ecpg_into: /* EMPTY */ { $$ = EMPTY; } + | ecpg_into { $$ = $1; } + ; + %% void base_yyerror(const char *error) diff -dcrpN pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.type pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.type *** pgsql.dynamiccur/src/interfaces/ecpg/preproc/ecpg.type 2009-10-03 01:36:11.000000000 +0200 --- pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.type 2009-10-03 01:41:51.000000000 +0200 *************** *** 76,81 **** --- 76,82 ---- %type <str> opt_bit_field %type <str> opt_connection_name %type <str> opt_database_name + %type <str> opt_ecpg_into %type <str> opt_ecpg_using %type <str> opt_initializer %type <str> opt_options diff -dcrpN pgsql.dynamiccur/src/interfaces/ecpg/preproc/parse.pl pgsql.fixshred/src/interfaces/ecpg/preproc/parse.pl *** pgsql.dynamiccur/src/interfaces/ecpg/preproc/parse.pl 2009-01-30 17:28:46.000000000 +0100 --- pgsql.fixshred/src/interfaces/ecpg/preproc/parse.pl 2009-10-03 01:54:56.000000000 +0200 *************** $replace_types{'unreserved_keyword'} = ' *** 57,63 **** $replace_types{'Sconst'} = 'ignore'; # some production rules have to be ignored or replaced ! $replace_line{'fetch_direction'} = 'ignore'; $replace_line{"opt_array_boundsopt_array_bounds'['Iconst']'"} = 'ignore'; $replace_line{'col_name_keywordCHAR_P'} = 'ignore'; $replace_line{'col_name_keywordINT_P'} = 'ignore'; --- 57,65 ---- $replace_types{'Sconst'} = 'ignore'; # some production rules have to be ignored or replaced ! $replace_line{'fetch_args'} = 'ignore'; ! $replace_line{'fetch_argsFORWARDopt_from_incursor_name'} = 'ignore'; ! $replace_line{'fetch_argsBACKWARDopt_from_incursor_name'} = 'ignore'; $replace_line{"opt_array_boundsopt_array_bounds'['Iconst']'"} = 'ignore'; $replace_line{'col_name_keywordCHAR_P'} = 'ignore'; $replace_line{'col_name_keywordINT_P'} = 'ignore'; diff -dcrpN pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.trailer pgsql.cname_in_varchar/src/interfaces/ecpg/preproc/ecpg.trailer *** pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 01:42:17.000000000 +0200 --- pgsql.cname_in_varchar/src/interfaces/ecpg/preproc/ecpg.trailer 2009-10-03 02:05:58.000000000 +0200 *************** char_variable: cvariable *** 228,233 **** --- 228,265 ---- } ; + cursor_char_variable: cvariable + { + /* check if we have a string variable */ + struct variable *p = find_variable($1); + enum ECPGttype type = p->type->type; + + /* If we have just one character this is not a string */ + if (atol(p->type->size) == 1) + mmerror(PARSE_ERROR, ET_ERROR, "invalid data type"); + else + { + /* if array see what's inside */ + if (type == ECPGt_array) + type = p->type->u.element->type; + + switch (type) + { + case ECPGt_char: + case ECPGt_unsigned_char: + case ECPGt_string: + case ECPGt_varchar: + $$ = $1; + break; + default: + mmerror(PARSE_ERROR, ET_ERROR, "invalid data type"); + $$ = $1; + break; + } + } + } + ; + opt_options: Op connect_options { if (strlen($1) == 0) *************** civarind: cvariable indicator *** 1798,1804 **** } ; ! char_civar: char_variable { add_variable_to_head(&argsinsert, find_variable($1), &no_indicator); $$ = $1; --- 1830,1836 ---- } ; ! char_civar: cursor_char_variable { add_variable_to_head(&argsinsert, find_variable($1), &no_indicator); $$ = $1; diff -dcrpN pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.type pgsql.cname_in_varchar/src/interfaces/ecpg/preproc/ecpg.type *** pgsql.fixshred/src/interfaces/ecpg/preproc/ecpg.type 2009-10-03 01:41:51.000000000 +0200 --- pgsql.cname_in_varchar/src/interfaces/ecpg/preproc/ecpg.type 2009-10-03 02:03:31.000000000 +0200 *************** *** 46,51 **** --- 46,52 ---- %type <str> char_civar %type <str> civar %type <str> civarind + %type <str> cursor_char_variable %type <str> ColLabel %type <str> connect_options %type <str> connection_object diff -dcrpN pgsql.cname_in_varchar/src/interfaces/ecpg/test/compat_informix/cursor.pgc pgsql.regressiontests/src/interfaces/ecpg/test/compat_informix/cursor.pgc *** pgsql.cname_in_varchar/src/interfaces/ecpg/test/compat_informix/cursor.pgc 1970-01-01 01:00:00.000000000 +0100 --- pgsql.regressiontests/src/interfaces/ecpg/test/compat_informix/cursor.pgc 2009-10-03 02:11:20.000000000 +0200 *************** *** 0 **** --- 1,245 ---- + #include <stdlib.h> + #include <string.h> + + exec sql include ../regression; + + exec sql whenever sqlerror stop; + + exec sql type c is char reference; + typedef char* c; + + exec sql type ind is union { int integer; short smallint; }; + typedef union { int integer; short smallint; } ind; + + #define BUFFERSIZ 8 + exec sql type str is varchar[BUFFERSIZ]; + + #define CURNAME "mycur" + + int + main (void) + { + exec sql begin declare section; + char *stmt1 = "SELECT id, t FROM t1"; + char *curname1 = CURNAME; + char *curname2 = CURNAME; + char *curname3 = CURNAME; + varchar curname4[50]; + int count; + int id; + char t[64]; + 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 t1(id serial primary key, t text); + + strcpy(msg, "insert"); + exec sql insert into t1(id, t) values (default, 'a'); + exec sql insert into t1(id, t) values (default, 'b'); + exec sql insert into t1(id, t) values (default, 'c'); + exec sql insert into t1(id, t) values (default, 'd'); + + strcpy(msg, "commit"); + exec sql commit; + + /* Dynamic cursorname test with INTO list in FETCH stmts */ + + strcpy(msg, "declare"); + exec sql declare :curname1 cursor for + select id, t from t1; + + strcpy(msg, "open"); + exec sql open :curname1; + + strcpy(msg, "fetch from"); + exec sql fetch from :curname1 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + exec sql fetch :curname1 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + exec sql fetch 1 from :curname1 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + exec sql fetch :count from :curname1 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "move in"); + exec sql move absolute 0 in :curname1; + + strcpy(msg, "fetch 1"); + exec sql fetch 1 :curname1 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + exec sql fetch :count :curname1 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + exec sql close :curname1; + + /* Dynamic cursorname test with INTO list in DECLARE stmt */ + + strcpy(msg, "declare"); + exec sql declare :curname2 cursor for + select id, t into :id, :t from t1; + + strcpy(msg, "open"); + exec sql open :curname2; + + strcpy(msg, "fetch from"); + exec sql fetch from :curname2; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + exec sql fetch :curname2; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + exec sql fetch 1 from :curname2; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + exec sql fetch :count from :curname2; + printf("%d %s\n", id, t); + + strcpy(msg, "move"); + exec sql move absolute 0 :curname2; + + strcpy(msg, "fetch 1"); + exec sql fetch 1 :curname2; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + exec sql fetch :count :curname2; + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + exec sql close :curname2; + + /* Dynamic cursorname test with PREPARED stmt */ + + strcpy(msg, "prepare"); + exec sql prepare st_id1 from :stmt1; + + strcpy(msg, "declare"); + exec sql declare :curname3 cursor for st_id1; + + strcpy(msg, "open"); + exec sql open :curname3; + + strcpy(msg, "fetch from"); + exec sql fetch from :curname3 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + exec sql fetch :curname3 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + exec sql fetch 1 from :curname3 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + exec sql fetch :count from :curname3 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "move"); + exec sql move absolute 0 :curname3; + + strcpy(msg, "fetch 1"); + exec sql fetch 1 :curname3 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + exec sql fetch :count :curname3 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + exec sql close :curname3; + + strcpy(msg, "deallocate prepare"); + exec sql deallocate prepare st_id1; + + /* Dynamic cursorname test with PREPARED stmt, + cursor name in varchar */ + + curname4.len = strlen(CURNAME); + strcpy(curname4.arr, CURNAME); + + strcpy(msg, "prepare"); + exec sql prepare st_id2 from :stmt1; + + strcpy(msg, "declare"); + exec sql declare :curname4 cursor for st_id2; + + strcpy(msg, "open"); + exec sql open :curname4; + + strcpy(msg, "fetch from"); + exec sql fetch from :curname4 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + exec sql fetch :curname4 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + exec sql fetch 1 from :curname4 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + exec sql fetch :count from :curname4 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "move"); + exec sql move absolute 0 :curname4; + + strcpy(msg, "fetch 1"); + exec sql fetch 1 :curname4 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + exec sql fetch :count :curname4 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + exec sql close :curname4; + + strcpy(msg, "deallocate prepare"); + exec sql deallocate prepare st_id2; + + /* End test */ + + strcpy(msg, "drop"); + exec sql drop table t1; + + strcpy(msg, "commit"); + exec sql commit; + + strcpy(msg, "disconnect"); + exec sql disconnect; + + return (0); + } diff -dcrpN pgsql.cname_in_varchar/src/interfaces/ecpg/test/compat_informix/Makefile pgsql.regressiontests/src/interfaces/ecpg/test/compat_informix/Makefile *** pgsql.cname_in_varchar/src/interfaces/ecpg/test/compat_informix/Makefile 2006-09-19 17:36:08.000000000 +0200 --- pgsql.regressiontests/src/interfaces/ecpg/test/compat_informix/Makefile 2009-10-03 02:11:20.000000000 +0200 *************** override LIBS := -lecpg_compat $(LIBS) *** 12,17 **** --- 12,18 ---- TESTS = test_informix test_informix.c \ test_informix2 test_informix2.c \ + cursor cursor.c \ dec_test dec_test.c \ rfmtdate rfmtdate.c \ rfmtlong rfmtlong.c \ *************** test_informix.c: test_informix.pgc ../re *** 26,31 **** --- 27,35 ---- test_informix2.c: test_informix2.pgc ../regression.h $(ECPG) -o $@ -I$(srcdir) $< + cursor.c: cursor.pgc ../regression.h + $(ECPG) -o $@ -I$(srcdir) $< + dec_test.c: dec_test.pgc ../regression.h $(ECPG) -o $@ -I$(srcdir) $< diff -dcrpN pgsql.cname_in_varchar/src/interfaces/ecpg/test/ecpg_schedule pgsql.regressiontests/src/interfaces/ecpg/test/ecpg_schedule *** pgsql.cname_in_varchar/src/interfaces/ecpg/test/ecpg_schedule 2008-10-29 11:40:29.000000000 +0100 --- pgsql.regressiontests/src/interfaces/ecpg/test/ecpg_schedule 2009-10-03 02:11:20.000000000 +0200 *************** test: compat_informix/charfuncs *** 3,8 **** --- 3,9 ---- test: compat_informix/rfmtdate test: compat_informix/rfmtlong test: compat_informix/rnull + test: compat_informix/cursor test: compat_informix/test_informix test: compat_informix/test_informix2 test: connect/test2 *************** test: pgtypeslib/num_test2 *** 16,21 **** --- 17,23 ---- test: preproc/array_of_struct test: preproc/autoprep test: preproc/comment + test: preproc/cursor test: preproc/define test: preproc/init test: preproc/strings diff -dcrpN pgsql.cname_in_varchar/src/interfaces/ecpg/test/ecpg_schedule_tcp pgsql.regressiontests/src/interfaces/ecpg/test/ecpg_schedule_tcp *** pgsql.cname_in_varchar/src/interfaces/ecpg/test/ecpg_schedule_tcp 2008-10-29 11:40:29.000000000 +0100 --- pgsql.regressiontests/src/interfaces/ecpg/test/ecpg_schedule_tcp 2009-10-03 02:11:20.000000000 +0200 *************** test: compat_informix/charfuncs *** 3,8 **** --- 3,9 ---- test: compat_informix/rfmtdate test: compat_informix/rfmtlong test: compat_informix/rnull + test: compat_informix/cursor test: compat_informix/test_informix test: compat_informix/test_informix2 test: connect/test2 *************** test: pgtypeslib/num_test2 *** 16,21 **** --- 17,23 ---- test: preproc/array_of_struct test: preproc/autoprep test: preproc/comment + test: preproc/cursor test: preproc/define test: preproc/init test: preproc/strings diff -dcrpN pgsql.cname_in_varchar/src/interfaces/ecpg/test/expected/compat_informix-cursor.c pgsql.regressiontests/src/interfaces/ecpg/test/expected/compat_informix-cursor.c *** pgsql.cname_in_varchar/src/interfaces/ecpg/test/expected/compat_informix-cursor.c 1970-01-01 01:00:00.000000000 +0100 --- pgsql.regressiontests/src/interfaces/ecpg/test/expected/compat_informix-cursor.c 2009-10-03 02:11:20.000000000 +0200 *************** *** 0 **** --- 1,766 ---- + /* 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 "cursor.pgc" + #include <stdlib.h> + #include <string.h> + + + #line 1 "regression.h" + + + + + + + #line 4 "cursor.pgc" + + + /* exec sql whenever sqlerror stop ; */ + #line 6 "cursor.pgc" + + + /* exec sql type c is char reference */ + #line 8 "cursor.pgc" + + typedef char* c; + + /* exec sql type ind is union { + #line 11 "cursor.pgc" + int integer ; + + #line 11 "cursor.pgc" + short smallint ; + } */ + #line 11 "cursor.pgc" + + typedef union { int integer; short smallint; } ind; + + #define BUFFERSIZ 8 + /* exec sql type str is [ BUFFERSIZ ] */ + #line 15 "cursor.pgc" + + + #define CURNAME "mycur" + + int + main (void) + { + /* exec sql begin declare section */ + + + + + + + + + + #line 23 "cursor.pgc" + char * stmt1 = "SELECT id, t FROM t1" ; + + #line 24 "cursor.pgc" + char * curname1 = CURNAME ; + + #line 25 "cursor.pgc" + char * curname2 = CURNAME ; + + #line 26 "cursor.pgc" + char * curname3 = CURNAME ; + + #line 27 "cursor.pgc" + struct varchar_curname4_27 { int len; char arr[ 50 ]; } curname4 ; + + #line 28 "cursor.pgc" + int count ; + + #line 29 "cursor.pgc" + int id ; + + #line 30 "cursor.pgc" + char t [ 64 ] ; + /* exec sql end declare section */ + #line 31 "cursor.pgc" + + + char msg[128]; + + ECPGdebug(1, stderr); + + strcpy(msg, "connect"); + { ECPGconnect(__LINE__, 1, "regress1" , NULL, NULL , NULL, 0); + #line 38 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 38 "cursor.pgc" + + + strcpy(msg, "set"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT); + #line 41 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 41 "cursor.pgc" + + + strcpy(msg, "create"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "create table t1 ( id serial primary key , t text )", ECPGt_EOIT,ECPGt_EORT); + #line 44 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 44 "cursor.pgc" + + + strcpy(msg, "insert"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'a' )", ECPGt_EOIT,ECPGt_EORT); + #line 47 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 47 "cursor.pgc" + + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'b' )", ECPGt_EOIT,ECPGt_EORT); + #line 48 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 48 "cursor.pgc" + + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'c' )", ECPGt_EOIT,ECPGt_EORT); + #line 49 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 49 "cursor.pgc" + + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'd' )", ECPGt_EOIT,ECPGt_EORT); + #line 50 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 50 "cursor.pgc" + + + strcpy(msg, "commit"); + { ECPGtrans(__LINE__, NULL, "commit"); + #line 53 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 53 "cursor.pgc" + + + /* Dynamic cursorname test with INTO list in FETCH stmts */ + + strcpy(msg, "declare"); + ECPG_informix_set_var( 0, &( curname1 ), __LINE__);\ + ECPG_informix_reset_sqlca(); /* declare $0 cursor for select id , t from t1 */ + #line 59 "cursor.pgc" + + + 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" + + if (sqlca.sqlcode < 0) exit (1);} + #line 62 "cursor.pgc" + + + strcpy(msg, "fetch from"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch from $0", + ECPGt_char,&(curname1),(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 65 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 65 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0", + ECPGt_char,&(curname1),(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 69 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 69 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch 1 from $0", + ECPGt_char,&(curname1),(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 73 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 73 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0 from $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,&(curname1),(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 78 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 78 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "move in"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "move absolute 0 in $0", + ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 82 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 82 "cursor.pgc" + + + strcpy(msg, "fetch 1"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch 1 $0", + ECPGt_char,&(curname1),(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 85 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 85 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0 $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,&(curname1),(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 90 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 90 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "close $0", + ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 94 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 94 "cursor.pgc" + + + /* Dynamic cursorname test with INTO list in DECLARE stmt */ + + strcpy(msg, "declare"); + ECPG_informix_set_var( 3, &( curname2 ), __LINE__);\ + ECPG_informix_set_var( 1, ( t ), __LINE__);\ + ECPG_informix_set_var( 2, &( id ), __LINE__);\ + ECPG_informix_reset_sqlca(); /* declare $0 cursor for select id , t from t1 */ + #line 100 "cursor.pgc" + + + 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" + + if (sqlca.sqlcode < 0) exit (1);} + #line 103 "cursor.pgc" + + + strcpy(msg, "fetch from"); + { 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" + + if (sqlca.sqlcode < 0) exit (1);} + #line 106 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + { 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" + + if (sqlca.sqlcode < 0) exit (1);} + #line 110 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + { 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" + + if (sqlca.sqlcode < 0) exit (1);} + #line 114 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0 from $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + 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" + + if (sqlca.sqlcode < 0) exit (1);} + #line 119 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "move"); + { 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" + + if (sqlca.sqlcode < 0) exit (1);} + #line 123 "cursor.pgc" + + + strcpy(msg, "fetch 1"); + { 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" + + if (sqlca.sqlcode < 0) exit (1);} + #line 126 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0 $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + 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" + + if (sqlca.sqlcode < 0) exit (1);} + #line 131 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + { 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 135 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 135 "cursor.pgc" + + + /* Dynamic cursorname test with PREPARED stmt */ + + strcpy(msg, "prepare"); + { ECPGprepare(__LINE__, NULL, 0, "st_id1", stmt1); + #line 140 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 140 "cursor.pgc" + + + strcpy(msg, "declare"); + ECPG_informix_reset_sqlca(); /* declare $0 cursor for $1 */ + #line 143 "cursor.pgc" + + + strcpy(msg, "open"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare $0 cursor for $1", + ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id1", __LINE__)),(long)1,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 146 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 146 "cursor.pgc" + + + strcpy(msg, "fetch from"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch from $0", + ECPGt_char,&(curname3),(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 149 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 149 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0", + ECPGt_char,&(curname3),(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 153 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 153 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch 1 from $0", + ECPGt_char,&(curname3),(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 157 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 157 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0 from $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,&(curname3),(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 162 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 162 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "move"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "move absolute 0 $0", + ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 166 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 166 "cursor.pgc" + + + strcpy(msg, "fetch 1"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch 1 $0", + ECPGt_char,&(curname3),(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 169 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 169 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0 $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,&(curname3),(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 174 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 174 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "close $0", + ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 178 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 178 "cursor.pgc" + + + strcpy(msg, "deallocate prepare"); + { ECPGdeallocate(__LINE__, 1, NULL, "st_id1"); + #line 181 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 181 "cursor.pgc" + + + /* Dynamic cursorname test with PREPARED stmt, + cursor name in varchar */ + + curname4.len = strlen(CURNAME); + strcpy(curname4.arr, CURNAME); + + strcpy(msg, "prepare"); + { ECPGprepare(__LINE__, NULL, 0, "st_id2", stmt1); + #line 190 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 190 "cursor.pgc" + + + strcpy(msg, "declare"); + ECPG_informix_reset_sqlca(); /* declare $0 cursor for $1 */ + #line 193 "cursor.pgc" + + + strcpy(msg, "open"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "declare $0 cursor for $1", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id2", __LINE__)),(long)1,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 196 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 196 "cursor.pgc" + + + strcpy(msg, "fetch from"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch from $0", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + 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 199 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 199 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + 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 203 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 203 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch 1 from $0", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + 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 207 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 207 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0 from $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + 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 212 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 212 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "move"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "move absolute 0 $0", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 216 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 216 "cursor.pgc" + + + strcpy(msg, "fetch 1"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch 1 $0", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + 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 219 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 219 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "fetch $0 $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + 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 224 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 224 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "close $0", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 228 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 228 "cursor.pgc" + + + strcpy(msg, "deallocate prepare"); + { ECPGdeallocate(__LINE__, 1, NULL, "st_id2"); + #line 231 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 231 "cursor.pgc" + + + /* End test */ + + strcpy(msg, "drop"); + { ECPGdo(__LINE__, 1, 1, NULL, 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT); + #line 236 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 236 "cursor.pgc" + + + strcpy(msg, "commit"); + { ECPGtrans(__LINE__, NULL, "commit"); + #line 239 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 239 "cursor.pgc" + + + strcpy(msg, "disconnect"); + { ECPGdisconnect(__LINE__, "CURRENT"); + #line 242 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 242 "cursor.pgc" + + + return (0); + } diff -dcrpN pgsql.cname_in_varchar/src/interfaces/ecpg/test/expected/compat_informix-cursor.stderr pgsql.regressiontests/src/interfaces/ecpg/test/expected/compat_informix-cursor.stderr *** pgsql.cname_in_varchar/src/interfaces/ecpg/test/expected/compat_informix-cursor.stderr 1970-01-01 01:00:00.000000000+0100 --- pgsql.regressiontests/src/interfaces/ecpg/test/expected/compat_informix-cursor.stderr 2009-10-03 02:11:20.000000000+0200 *************** *** 0 **** --- 1,372 ---- + [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 41: 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 41: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 41: OK: SET + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 44: query: create table t1 ( id serial primary key , t text ); with 0 parameter(s) on connectionregress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 44: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 44: OK: CREATE TABLE + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 47: query: insert into t1 ( id , t ) values ( default , 'a' ); with 0 parameter(s) on connectionregress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 47: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 47: OK: INSERT 0 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 48: query: insert into t1 ( id , t ) values ( default , 'b' ); with 0 parameter(s) on connectionregress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 48: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 48: OK: INSERT 0 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 49: query: insert into t1 ( id , t ) values ( default , 'c' ); with 0 parameter(s) on connectionregress1 + [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: OK: INSERT 0 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 50: query: insert into t1 ( id , t ) values ( default , 'd' ); with 0 parameter(s) on connectionregress1 + [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: OK: INSERT 0 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGtrans on line 53: action "commit"; connection "regress1" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 62: query: declare mycur cursor for select id , t from t1; with 0 parameter(s) on connectionregress1 + [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: DECLARE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 65: query: fetch from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 65: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 65: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 65: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 65: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 69: query: fetch mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 69: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 69: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 69: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 69: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 73: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 73: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 73: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 73: RESULT: 3 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 73: RESULT: c offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 78: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 78: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 78: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 78: RESULT: 4 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 78: RESULT: d offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 82: query: move absolute 0 in mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 82: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 82: OK: MOVE 0 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 85: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 85: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 85: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 85: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 85: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 90: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 90: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 90: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 90: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 90: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 94: query: close mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 94: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 94: OK: CLOSE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 103: query: declare mycur cursor for select id , t from t1; with 0 parameter(s) on connectionregress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 103: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 103: OK: DECLARE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 106: query: fetch from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 106: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 106: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 106: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 106: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 110: query: fetch mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 110: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 110: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 110: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 110: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 114: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 114: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 114: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 114: RESULT: 3 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 114: RESULT: c offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 119: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 119: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 119: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 119: RESULT: 4 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 119: RESULT: d offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 123: query: move absolute 0 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 123: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 123: OK: MOVE 0 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 126: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 126: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 126: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 126: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 126: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 131: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 131: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 131: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 131: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 131: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 135: query: close mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 135: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 135: OK: CLOSE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGprepare on line 140: name st_id1; query: "SELECT id, t FROM t1" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 146: query: declare mycur cursor for SELECT id, t FROM t1; with 0 parameter(s) on connectionregress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 146: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 146: OK: DECLARE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 149: query: fetch from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 149: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 149: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 149: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 149: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 153: query: fetch mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 153: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 153: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 153: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 153: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 157: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 157: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 157: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 157: RESULT: 3 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 157: RESULT: c offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 162: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 162: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 162: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 162: RESULT: 4 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 162: RESULT: d offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 166: query: move absolute 0 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 166: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 166: OK: MOVE 0 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 169: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 169: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 169: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 169: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 169: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 174: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 174: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 174: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 174: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 174: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 178: query: close mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 178: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 178: OK: CLOSE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGdeallocate on line 181: name st_id1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGprepare on line 190: name st_id2; query: "SELECT id, t FROM t1" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 196: query: declare mycur cursor for SELECT id, t FROM t1; with 0 parameter(s) on connectionregress1 + [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: DECLARE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 199: query: fetch from mycur; 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: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 199: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 199: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 203: query: fetch mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 203: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 203: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 203: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 203: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 207: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 207: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 207: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 207: RESULT: 3 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 207: RESULT: c offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 212: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 212: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 212: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 212: RESULT: 4 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 212: RESULT: d offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 216: query: move absolute 0 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 216: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 216: OK: MOVE 0 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 219: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 219: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 219: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 219: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 219: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 224: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 224: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 224: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 224: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 224: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 228: query: close mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 228: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 228: OK: CLOSE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGdeallocate on line 231: name st_id2 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 236: query: drop table t1; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 236: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 236: OK: DROP TABLE + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGtrans on line 239: 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.cname_in_varchar/src/interfaces/ecpg/test/expected/compat_informix-cursor.stdout pgsql.regressiontests/src/interfaces/ecpg/test/expected/compat_informix-cursor.stdout *** pgsql.cname_in_varchar/src/interfaces/ecpg/test/expected/compat_informix-cursor.stdout 1970-01-01 01:00:00.000000000+0100 --- pgsql.regressiontests/src/interfaces/ecpg/test/expected/compat_informix-cursor.stdout 2009-10-03 02:11:20.000000000+0200 *************** *** 0 **** --- 1,24 ---- + 1 a + 2 b + 3 c + 4 d + 1 a + 2 b + 1 a + 2 b + 3 c + 4 d + 1 a + 2 b + 1 a + 2 b + 3 c + 4 d + 1 a + 2 b + 1 a + 2 b + 3 c + 4 d + 1 a + 2 b diff -dcrpN pgsql.cname_in_varchar/src/interfaces/ecpg/test/expected/preproc-cursor.c pgsql.regressiontests/src/interfaces/ecpg/test/expected/preproc-cursor.c *** pgsql.cname_in_varchar/src/interfaces/ecpg/test/expected/preproc-cursor.c 1970-01-01 01:00:00.000000000 +0100 --- pgsql.regressiontests/src/interfaces/ecpg/test/expected/preproc-cursor.c 2009-10-03 02:11:20.000000000 +0200 *************** *** 0 **** --- 1,760 ---- + /* Processed by ecpg (regression mode) */ + /* These include files are added by the preprocessor */ + #include <ecpglib.h> + #include <ecpgerrno.h> + #include <sqlca.h> + /* End of automatic include section */ + #define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y)) + + #line 1 "cursor.pgc" + #include <stdlib.h> + #include <string.h> + + + #line 1 "regression.h" + + + + + + + #line 4 "cursor.pgc" + + + /* exec sql whenever sqlerror stop ; */ + #line 6 "cursor.pgc" + + + /* exec sql type c is char reference */ + #line 8 "cursor.pgc" + + typedef char* c; + + /* exec sql type ind is union { + #line 11 "cursor.pgc" + int integer ; + + #line 11 "cursor.pgc" + short smallint ; + } */ + #line 11 "cursor.pgc" + + typedef union { int integer; short smallint; } ind; + + #define BUFFERSIZ 8 + /* exec sql type str is [ BUFFERSIZ ] */ + #line 15 "cursor.pgc" + + + #define CURNAME "mycur" + + int + main (void) + { + /* exec sql begin declare section */ + + + + + + + + + + #line 23 "cursor.pgc" + char * stmt1 = "SELECT id, t FROM t1" ; + + #line 24 "cursor.pgc" + char * curname1 = CURNAME ; + + #line 25 "cursor.pgc" + char * curname2 = CURNAME ; + + #line 26 "cursor.pgc" + char * curname3 = CURNAME ; + + #line 27 "cursor.pgc" + struct varchar_curname4_27 { int len; char arr[ 50 ]; } curname4 ; + + #line 28 "cursor.pgc" + int count ; + + #line 29 "cursor.pgc" + int id ; + + #line 30 "cursor.pgc" + char t [ 64 ] ; + /* exec sql end declare section */ + #line 31 "cursor.pgc" + + + char msg[128]; + + ECPGdebug(1, stderr); + + strcpy(msg, "connect"); + { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); + #line 38 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 38 "cursor.pgc" + + + strcpy(msg, "set"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT); + #line 41 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 41 "cursor.pgc" + + + strcpy(msg, "create"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table t1 ( id serial primary key , t text )", ECPGt_EOIT,ECPGt_EORT); + #line 44 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 44 "cursor.pgc" + + + strcpy(msg, "insert"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'a' )", ECPGt_EOIT,ECPGt_EORT); + #line 47 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 47 "cursor.pgc" + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'b' )", ECPGt_EOIT,ECPGt_EORT); + #line 48 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 48 "cursor.pgc" + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'c' )", ECPGt_EOIT,ECPGt_EORT); + #line 49 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 49 "cursor.pgc" + + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into t1 ( id , t ) values ( default , 'd' )", ECPGt_EOIT,ECPGt_EORT); + #line 50 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 50 "cursor.pgc" + + + strcpy(msg, "commit"); + { ECPGtrans(__LINE__, NULL, "commit"); + #line 53 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 53 "cursor.pgc" + + + /* Dynamic cursorname test with INTO list in FETCH stmts */ + + strcpy(msg, "declare"); + /* declare $0 cursor for select id , t from t1 */ + #line 59 "cursor.pgc" + + + strcpy(msg, "open"); + { ECPGdo(__LINE__, 0, 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);} + #line 62 "cursor.pgc" + + + strcpy(msg, "fetch from"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch from $0", + ECPGt_char,&(curname1),(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 65 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 65 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0", + ECPGt_char,&(curname1),(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 69 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 69 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 from $0", + ECPGt_char,&(curname1),(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 73 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 73 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 from $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,&(curname1),(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 78 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 78 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "move in"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "move absolute 0 in $0", + ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 82 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 82 "cursor.pgc" + + + strcpy(msg, "fetch 1"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 $0", + ECPGt_char,&(curname1),(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 85 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 85 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,&(curname1),(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 90 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 90 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close $0", + ECPGt_char,&(curname1),(long)0,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 94 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 94 "cursor.pgc" + + + /* Dynamic cursorname test with INTO list in DECLARE stmt */ + + strcpy(msg, "declare"); + /* declare $0 cursor for select id , t from t1 */ + #line 100 "cursor.pgc" + + + strcpy(msg, "open"); + { ECPGdo(__LINE__, 0, 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);} + #line 103 "cursor.pgc" + + + strcpy(msg, "fetch from"); + { ECPGdo(__LINE__, 0, 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);} + #line 106 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + { ECPGdo(__LINE__, 0, 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);} + #line 110 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + { ECPGdo(__LINE__, 0, 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);} + #line 114 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 from $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + 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);} + #line 119 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "move"); + { ECPGdo(__LINE__, 0, 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);} + #line 123 "cursor.pgc" + + + strcpy(msg, "fetch 1"); + { ECPGdo(__LINE__, 0, 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);} + #line 126 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + 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);} + #line 131 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + { ECPGdo(__LINE__, 0, 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 135 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 135 "cursor.pgc" + + + /* Dynamic cursorname test with PREPARED stmt */ + + strcpy(msg, "prepare"); + { ECPGprepare(__LINE__, NULL, 0, "st_id1", stmt1); + #line 140 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 140 "cursor.pgc" + + + strcpy(msg, "declare"); + /* declare $0 cursor for $1 */ + #line 143 "cursor.pgc" + + + strcpy(msg, "open"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare $0 cursor for $1", + ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id1", __LINE__)),(long)1,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 146 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 146 "cursor.pgc" + + + strcpy(msg, "fetch from"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch from $0", + ECPGt_char,&(curname3),(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 149 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 149 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0", + ECPGt_char,&(curname3),(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 153 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 153 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 from $0", + ECPGt_char,&(curname3),(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 157 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 157 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 from $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,&(curname3),(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 162 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 162 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "move"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "move absolute 0 $0", + ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 166 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 166 "cursor.pgc" + + + strcpy(msg, "fetch 1"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 $0", + ECPGt_char,&(curname3),(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 169 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 169 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,&(curname3),(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 174 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 174 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close $0", + ECPGt_char,&(curname3),(long)0,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 178 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 178 "cursor.pgc" + + + strcpy(msg, "deallocate prepare"); + { ECPGdeallocate(__LINE__, 0, NULL, "st_id1"); + #line 181 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 181 "cursor.pgc" + + + /* Dynamic cursorname test with PREPARED stmt, + cursor name in varchar */ + + curname4.len = strlen(CURNAME); + strcpy(curname4.arr, CURNAME); + + strcpy(msg, "prepare"); + { ECPGprepare(__LINE__, NULL, 0, "st_id2", stmt1); + #line 190 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 190 "cursor.pgc" + + + strcpy(msg, "declare"); + /* declare $0 cursor for $1 */ + #line 193 "cursor.pgc" + + + strcpy(msg, "open"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare $0 cursor for $1", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id2", __LINE__)),(long)1,(long)1,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 196 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 196 "cursor.pgc" + + + strcpy(msg, "fetch from"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch from $0", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + 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 199 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 199 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + 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 203 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 203 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 from $0", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + 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 207 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 207 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 from $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + 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 212 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 212 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "move"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "move absolute 0 $0", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 216 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 216 "cursor.pgc" + + + strcpy(msg, "fetch 1"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 $0", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + 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 219 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 219 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 $0", + ECPGt_int,&(count),(long)1,(long)1,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + 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 224 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 224 "cursor.pgc" + + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close $0", + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); + #line 228 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 228 "cursor.pgc" + + + strcpy(msg, "deallocate prepare"); + { ECPGdeallocate(__LINE__, 0, NULL, "st_id2"); + #line 231 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 231 "cursor.pgc" + + + /* End test */ + + strcpy(msg, "drop"); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table t1", ECPGt_EOIT, ECPGt_EORT); + #line 236 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 236 "cursor.pgc" + + + strcpy(msg, "commit"); + { ECPGtrans(__LINE__, NULL, "commit"); + #line 239 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 239 "cursor.pgc" + + + strcpy(msg, "disconnect"); + { ECPGdisconnect(__LINE__, "CURRENT"); + #line 242 "cursor.pgc" + + if (sqlca.sqlcode < 0) exit (1);} + #line 242 "cursor.pgc" + + + return (0); + } diff -dcrpN pgsql.cname_in_varchar/src/interfaces/ecpg/test/expected/preproc-cursor.stderr pgsql.regressiontests/src/interfaces/ecpg/test/expected/preproc-cursor.stderr *** pgsql.cname_in_varchar/src/interfaces/ecpg/test/expected/preproc-cursor.stderr 1970-01-01 01:00:00.000000000 +0100 --- pgsql.regressiontests/src/interfaces/ecpg/test/expected/preproc-cursor.stderr 2009-10-03 02:11:20.000000000 +0200 *************** *** 0 **** --- 1,372 ---- + [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 41: 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 41: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 41: OK: SET + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 44: query: create table t1 ( id serial primary key , t text ); with 0 parameter(s) on connectionregress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 44: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 44: OK: CREATE TABLE + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 47: query: insert into t1 ( id , t ) values ( default , 'a' ); with 0 parameter(s) on connectionregress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 47: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 47: OK: INSERT 0 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 48: query: insert into t1 ( id , t ) values ( default , 'b' ); with 0 parameter(s) on connectionregress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 48: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 48: OK: INSERT 0 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 49: query: insert into t1 ( id , t ) values ( default , 'c' ); with 0 parameter(s) on connectionregress1 + [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: OK: INSERT 0 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 50: query: insert into t1 ( id , t ) values ( default , 'd' ); with 0 parameter(s) on connectionregress1 + [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: OK: INSERT 0 1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGtrans on line 53: action "commit"; connection "regress1" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 62: query: declare mycur cursor for select id , t from t1; with 0 parameter(s) on connectionregress1 + [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: DECLARE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 65: query: fetch from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 65: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 65: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 65: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 65: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 69: query: fetch mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 69: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 69: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 69: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 69: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 73: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 73: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 73: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 73: RESULT: 3 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 73: RESULT: c offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 78: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 78: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 78: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 78: RESULT: 4 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 78: RESULT: d offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 82: query: move absolute 0 in mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 82: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 82: OK: MOVE 0 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 85: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 85: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 85: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 85: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 85: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 90: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 90: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 90: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 90: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 90: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 94: query: close mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 94: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 94: OK: CLOSE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 103: query: declare mycur cursor for select id , t from t1; with 0 parameter(s) on connectionregress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 103: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 103: OK: DECLARE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 106: query: fetch from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 106: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 106: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 106: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 106: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 110: query: fetch mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 110: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 110: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 110: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 110: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 114: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 114: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 114: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 114: RESULT: 3 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 114: RESULT: c offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 119: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 119: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 119: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 119: RESULT: 4 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 119: RESULT: d offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 123: query: move absolute 0 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 123: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 123: OK: MOVE 0 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 126: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 126: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 126: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 126: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 126: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 131: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 131: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 131: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 131: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 131: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 135: query: close mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 135: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 135: OK: CLOSE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGprepare on line 140: name st_id1; query: "SELECT id, t FROM t1" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 146: query: declare mycur cursor for SELECT id, t FROM t1; with 0 parameter(s) on connectionregress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 146: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 146: OK: DECLARE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 149: query: fetch from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 149: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 149: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 149: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 149: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 153: query: fetch mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 153: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 153: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 153: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 153: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 157: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 157: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 157: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 157: RESULT: 3 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 157: RESULT: c offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 162: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 162: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 162: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 162: RESULT: 4 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 162: RESULT: d offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 166: query: move absolute 0 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 166: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 166: OK: MOVE 0 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 169: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 169: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 169: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 169: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 169: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 174: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 174: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 174: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 174: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 174: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 178: query: close mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 178: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 178: OK: CLOSE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGdeallocate on line 181: name st_id1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGprepare on line 190: name st_id2; query: "SELECT id, t FROM t1" + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 196: query: declare mycur cursor for SELECT id, t FROM t1; with 0 parameter(s) on connectionregress1 + [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: DECLARE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 199: query: fetch from mycur; 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: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 199: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 199: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 203: query: fetch mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 203: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 203: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 203: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 203: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 207: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 207: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 207: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 207: RESULT: 3 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 207: RESULT: c offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 212: query: fetch 1 from mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 212: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 212: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 212: RESULT: 4 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 212: RESULT: d offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 216: query: move absolute 0 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 216: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 216: OK: MOVE 0 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 219: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 219: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 219: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 219: RESULT: 1 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 219: RESULT: a offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 224: query: fetch 1 mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 224: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 224: correctly got 1 tuples with 2 fields + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 224: RESULT: 2 offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_get_data on line 224: RESULT: b offset: -1; array: yes + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 228: query: close mycur; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 228: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 228: OK: CLOSE CURSOR + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGdeallocate on line 231: name st_id2 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 236: query: drop table t1; with 0 parameter(s) on connection regress1 + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 236: using PQexec + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ecpg_execute on line 236: OK: DROP TABLE + [NO_PID]: sqlca: code: 0, state: 00000 + [NO_PID]: ECPGtrans on line 239: 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.cname_in_varchar/src/interfaces/ecpg/test/expected/preproc-cursor.stdout pgsql.regressiontests/src/interfaces/ecpg/test/expected/preproc-cursor.stdout *** pgsql.cname_in_varchar/src/interfaces/ecpg/test/expected/preproc-cursor.stdout 1970-01-01 01:00:00.000000000 +0100 --- pgsql.regressiontests/src/interfaces/ecpg/test/expected/preproc-cursor.stdout 2009-10-03 02:11:20.000000000 +0200 *************** *** 0 **** --- 1,24 ---- + 1 a + 2 b + 3 c + 4 d + 1 a + 2 b + 1 a + 2 b + 3 c + 4 d + 1 a + 2 b + 1 a + 2 b + 3 c + 4 d + 1 a + 2 b + 1 a + 2 b + 3 c + 4 d + 1 a + 2 b diff -dcrpN pgsql.cname_in_varchar/src/interfaces/ecpg/test/preproc/cursor.pgc pgsql.regressiontests/src/interfaces/ecpg/test/preproc/cursor.pgc *** pgsql.cname_in_varchar/src/interfaces/ecpg/test/preproc/cursor.pgc 1970-01-01 01:00:00.000000000 +0100 --- pgsql.regressiontests/src/interfaces/ecpg/test/preproc/cursor.pgc 2009-10-03 02:11:20.000000000 +0200 *************** *** 0 **** --- 1,245 ---- + #include <stdlib.h> + #include <string.h> + + exec sql include ../regression; + + exec sql whenever sqlerror stop; + + exec sql type c is char reference; + typedef char* c; + + exec sql type ind is union { int integer; short smallint; }; + typedef union { int integer; short smallint; } ind; + + #define BUFFERSIZ 8 + exec sql type str is varchar[BUFFERSIZ]; + + #define CURNAME "mycur" + + int + main (void) + { + exec sql begin declare section; + char *stmt1 = "SELECT id, t FROM t1"; + char *curname1 = CURNAME; + char *curname2 = CURNAME; + char *curname3 = CURNAME; + varchar curname4[50]; + int count; + int id; + char t[64]; + 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 t1(id serial primary key, t text); + + strcpy(msg, "insert"); + exec sql insert into t1(id, t) values (default, 'a'); + exec sql insert into t1(id, t) values (default, 'b'); + exec sql insert into t1(id, t) values (default, 'c'); + exec sql insert into t1(id, t) values (default, 'd'); + + strcpy(msg, "commit"); + exec sql commit; + + /* Dynamic cursorname test with INTO list in FETCH stmts */ + + strcpy(msg, "declare"); + exec sql declare :curname1 cursor for + select id, t from t1; + + strcpy(msg, "open"); + exec sql open :curname1; + + strcpy(msg, "fetch from"); + exec sql fetch from :curname1 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + exec sql fetch :curname1 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + exec sql fetch 1 from :curname1 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + exec sql fetch :count from :curname1 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "move in"); + exec sql move absolute 0 in :curname1; + + strcpy(msg, "fetch 1"); + exec sql fetch 1 :curname1 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + exec sql fetch :count :curname1 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + exec sql close :curname1; + + /* Dynamic cursorname test with INTO list in DECLARE stmt */ + + strcpy(msg, "declare"); + exec sql declare :curname2 cursor for + select id, t into :id, :t from t1; + + strcpy(msg, "open"); + exec sql open :curname2; + + strcpy(msg, "fetch from"); + exec sql fetch from :curname2; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + exec sql fetch :curname2; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + exec sql fetch 1 from :curname2; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + exec sql fetch :count from :curname2; + printf("%d %s\n", id, t); + + strcpy(msg, "move"); + exec sql move absolute 0 :curname2; + + strcpy(msg, "fetch 1"); + exec sql fetch 1 :curname2; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + exec sql fetch :count :curname2; + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + exec sql close :curname2; + + /* Dynamic cursorname test with PREPARED stmt */ + + strcpy(msg, "prepare"); + exec sql prepare st_id1 from :stmt1; + + strcpy(msg, "declare"); + exec sql declare :curname3 cursor for st_id1; + + strcpy(msg, "open"); + exec sql open :curname3; + + strcpy(msg, "fetch from"); + exec sql fetch from :curname3 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + exec sql fetch :curname3 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + exec sql fetch 1 from :curname3 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + exec sql fetch :count from :curname3 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "move"); + exec sql move absolute 0 :curname3; + + strcpy(msg, "fetch 1"); + exec sql fetch 1 :curname3 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + exec sql fetch :count :curname3 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + exec sql close :curname3; + + strcpy(msg, "deallocate prepare"); + exec sql deallocate prepare st_id1; + + /* Dynamic cursorname test with PREPARED stmt, + cursor name in varchar */ + + curname4.len = strlen(CURNAME); + strcpy(curname4.arr, CURNAME); + + strcpy(msg, "prepare"); + exec sql prepare st_id2 from :stmt1; + + strcpy(msg, "declare"); + exec sql declare :curname4 cursor for st_id2; + + strcpy(msg, "open"); + exec sql open :curname4; + + strcpy(msg, "fetch from"); + exec sql fetch from :curname4 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch"); + exec sql fetch :curname4 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch 1 from"); + exec sql fetch 1 from :curname4 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count from"); + count = 1; + exec sql fetch :count from :curname4 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "move"); + exec sql move absolute 0 :curname4; + + strcpy(msg, "fetch 1"); + exec sql fetch 1 :curname4 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "fetch :count"); + count = 1; + exec sql fetch :count :curname4 into :id, :t; + printf("%d %s\n", id, t); + + strcpy(msg, "close"); + exec sql close :curname4; + + strcpy(msg, "deallocate prepare"); + exec sql deallocate prepare st_id2; + + /* End test */ + + strcpy(msg, "drop"); + exec sql drop table t1; + + strcpy(msg, "commit"); + exec sql commit; + + strcpy(msg, "disconnect"); + exec sql disconnect; + + return (0); + } diff -dcrpN pgsql.cname_in_varchar/src/interfaces/ecpg/test/preproc/Makefile pgsql.regressiontests/src/interfaces/ecpg/test/preproc/Makefile *** pgsql.cname_in_varchar/src/interfaces/ecpg/test/preproc/Makefile 2008-10-29 11:40:29.000000000 +0100 --- pgsql.regressiontests/src/interfaces/ecpg/test/preproc/Makefile 2009-10-03 02:11:20.000000000 +0200 *************** include $(top_srcdir)/$(subdir)/../Makef *** 7,12 **** --- 7,13 ---- TESTS = array_of_struct array_of_struct.c \ autoprep autoprep.c \ comment comment.c \ + cursor cursor.c \ define define.c \ init init.c \ strings strings.c \ diff -dcrpN pgsql.regressiontests/src/interfaces/ecpg/preproc/parse.pl pgsql.fixparsepl/src/interfaces/ecpg/preproc/parse.pl *** pgsql.regressiontests/src/interfaces/ecpg/preproc/parse.pl 2009-10-03 01:54:56.000000000 +0200 --- pgsql.fixparsepl/src/interfaces/ecpg/preproc/parse.pl 2009-10-03 02:18:47.000000000 +0200 *************** sub include_stuff { *** 313,318 **** --- 313,319 ---- local($includestream, $includefilename, $includeblock, $copy, $field_count) = @_; $copied = 0; $inblock = 0; + $have_addon = 0; $filename = $path . "/" . $includefilename; while (($_ = &Getline2($filename),$getline_ok)) { if ($includeblock ne '' && $Fld[1] eq 'ECPG:' && $inblock == 0) { *************** sub include_stuff { *** 321,329 **** $inblock = 1; $includetype = $Fld[3]; if ($includetype eq 'rule') { ! &dump_fields($stmt_mode, *fields, $field_count, ' { '); } elsif ($includetype eq 'addon') { &add_to_buffer('rules', ' { '); } } --- 322,336 ---- $inblock = 1; $includetype = $Fld[3]; if ($includetype eq 'rule') { ! if ($have_addon == 0) { ! &dump_fields($stmt_mode, *fields, $field_count, ' { '); ! } ! else { ! &dump_fields($stmt_mode, *fields, $field_count, ''); ! } } elsif ($includetype eq 'addon') { + $have_addon = 1; &add_to_buffer('rules', ' { '); } }
pgsql-hackers by date: