Re: check the execution status of stored procedure

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: check the execution status of stored procedure
Дата
Msg-id
5003.1262960342@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
check the execution status of stored procedure Yan Cheng Cheok <yccheok@yahoo.com>
Re: check the execution status of stored procedure Tom Lane <tgl@sss.pgh.pa.us>
Yan Cheng Cheok  writes:
> Currently, I try to call a stored procedure with void returned type.
>     PGresult *res = PQexec(this->getConnection(), "SELECT * FROM create_tables()");
>     if (PQresultStatus(res) != PGRES_COMMAND_OK)
>     {
>         PQclear(res);
>         return false;
>     }

> Since the returned type of stored procedure is void, I will always fall in to the block

> if (PQresultStatus(res) != PGRES_COMMAND_OK) {}

A successful SELECT command will return PGRES_TUPLES_OK, not
PGRES_COMMAND_OK.  Whether the function result is void or not doesn't
change that.

			regards, tom lane
В списке pgsql-general по дате отправления
От: Tom Lane
Дата:
От: Greg Sabino Mullane
Дата:
Сообщение: Re: Server name in psql prompt
FAQ