1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Change error handling of out of scope variables in ecpg.

The function called can result in an out of memory error that subsequently was
disregarded. Instead it should set the appropriate SQL error variables and be
checked by whatever whenever statement is defined.
This commit is contained in:
Michael Meskes
2019-01-30 13:58:25 +01:00
parent e2f731cdba
commit 7ea38f045d
10 changed files with 75 additions and 21 deletions

View File

@ -525,6 +525,17 @@ ECPGset_var(int number, void *pointer, int lineno)
{
struct var_list *ptr;
struct sqlca_t *sqlca = ECPGget_sqlca();
if (sqlca == NULL)
{
ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
return;
}
ecpg_init_sqlca(sqlca);
for (ptr = ivlist; ptr != NULL; ptr = ptr->next)
{
if (ptr->number == number)