Re: Problem on PostgreSQL (error code, store procedures)

Поиск
Список
Период
Сортировка
От Christoph Haller
Тема Re: Problem on PostgreSQL (error code, store procedures)
Дата
Msg-id 200207101047.MAA06942@rodos
обсуждение исходный текст
Ответ на Problem on PostgreSQL (error code, store procedures)  (Carmen Wai <carmen_wai@yahoo.com>)
Список pgsql-sql
> 
> I would like to know if there are any global variables
> storing the error code or the number of rows affected
> after each execution of the SQL statement.

You did not mention which interface you are using. 
In C there are functions available like extern const char *PQcmdTuples(PGresult *res);to learn about the rows affected
orextern int    PQntuples(PGresult *res);to learn about the number of rows found (SELECT) or extern ExecStatusType
PQresultStatus(PGresult*res);to learn about the status of the SQL command. 
 
Unfortunately, there are no error codes at all. 
In PL/pgSQL (which I do not use) I've found GET DIAGNOSTICS variable = ROW_COUNT ; refer to plpgsql-statements.html 

> 
> Also, for Postgresql function, I have checked that I
> can only call the function by: select function(parms)
> or by EXECUTE PROCEDURE function(parms) in the trigger
> action. I wonder whether there is any other method for
> calling the function which is similar to the stored
> procedures in the MS SQL server?

I'm afraid NO. 

Regards, Christoph 



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Ian Cass"
Дата:
Сообщение: Help with function optimisation
Следующее
От: Christoph Haller
Дата:
Сообщение: Re: Variables in PSQL