Skip to content

Commit eb730cf

Browse files
author
Michael Meskes
committed
Added correct error handling in DESCRIBE statement processing by Boszormenyi Zoltan <zb@cybertec.at>.
1 parent d3be71a commit eb730cf

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/interfaces/ecpg/ecpglib/descriptor.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* dynamic SQL support routines
22
*
3-
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.34 2010/01/15 10:44:34 meskes Exp $
3+
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.35 2010/01/15 13:19:12 meskes Exp $
44
*/
55

66
#define POSTGRES_ECPG_INTERNAL
@@ -739,14 +739,24 @@ ECPGdescribe(int line, int compat, bool input, const char *connection_name, cons
739739

740740
/* DESCRIBE INPUT is not yet supported */
741741
if (input)
742+
{
743+
ecpg_raise(line, ECPG_UNSUPPORTED, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, "DESCRIBE INPUT");
742744
return ret;
745+
}
743746

744747
con = ecpg_get_connection(connection_name);
745748
if (!con)
746-
return false;
749+
{
750+
ecpg_raise(line, ECPG_NO_CONN, ECPG_SQLSTATE_CONNECTION_DOES_NOT_EXIST,
751+
connection_name ? connection_name : ecpg_gettext("NULL"));
752+
return ret;
753+
}
747754
prep = ecpg_find_prepared_statement(stmt_name, con, NULL);
748755
if (!prep)
756+
{
757+
ecpg_raise(line, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMENT_NAME, stmt_name);
749758
return ret;
759+
}
750760

751761
va_start(args, stmt_name);
752762

0 commit comments

Comments
 (0)