diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index 9dc77647ae..663e044184 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -2310,4 +2310,6 @@ Wed, 06 Feb 2008 09:04:48 +0100 Thu, 14 Feb 2008 13:11:34 +0100 - Added SQLSTATE macro closing bug #3961. + - EXECUTE can return NOT FOUND so it should be checked here too. + - Changed regression test accordingly. diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index 9bcf994480..6dd32b930b 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.359 2008/01/15 10:31:47 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.360 2008/02/14 14:54:48 meskes Exp $ */ /* Copyright comment */ %{ @@ -807,7 +807,7 @@ stmt: AlterDatabaseStmt { output_statement($1, 0, ECPGst_normal); } | DropUserStmt { output_statement($1, 0, ECPGst_normal); } | DropdbStmt { output_statement($1, 0, ECPGst_normal); } | ExplainStmt { output_statement($1, 0, ECPGst_normal); } - | ExecuteStmt { output_statement($1, 0, ECPGst_execute); } + | ExecuteStmt { output_statement($1, 1, ECPGst_execute); } | FetchStmt { output_statement($1, 1, ECPGst_normal); } | GrantStmt { output_statement($1, 0, ECPGst_normal); } | GrantRoleStmt { output_statement($1, 0, ECPGst_normal); } diff --git a/src/interfaces/ecpg/test/expected/sql-execute.c b/src/interfaces/ecpg/test/expected/sql-execute.c index 7aa926ffa6..eecdf6e56e 100644 --- a/src/interfaces/ecpg/test/expected/sql-execute.c +++ b/src/interfaces/ecpg/test/expected/sql-execute.c @@ -254,23 +254,78 @@ if (sqlca.sqlcode < 0) sqlprint();} if (sqlca.sqlcode < 0) sqlprint();} #line 88 "execute.pgc" - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table test ", ECPGt_EOIT, ECPGt_EORT); + { ECPGdeallocate(__LINE__, 0, NULL, "f"); #line 89 "execute.pgc" if (sqlca.sqlcode < 0) sqlprint();} #line 89 "execute.pgc" + + sprintf (command, "select * from test where amount = $1"); + + { ECPGprepare(__LINE__, NULL, 0, "f", command); +#line 93 "execute.pgc" + +if (sqlca.sqlcode < 0) sqlprint();} +#line 93 "execute.pgc" + + { ECPGdo(__LINE__, 0, 1, NULL, 0, 1, "f", + ECPGt_const,"2",(long)1,(long)1,strlen("2"), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, + ECPGt_char,(name),(long)8,(long)8,(8)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_int,(amount),(long)1,(long)8,sizeof(int), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, + ECPGt_char,(letter),(long)1,(long)8,(1)*sizeof(char), + ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); +#line 94 "execute.pgc" + +if (sqlca.sqlcode < 0) sqlprint();} +#line 94 "execute.pgc" + + + for (i=0, j=sqlca.sqlerrd[2]; i