[PATCH] pg_result_sqlstate

php.internals

Markus Bertheau

21 years ago
Hi, attached is a patch which implements a function pg_result_sqlstate. This function is needed because the error messages returned by pg_result_error is localized and can therefor not be parsed reliably. The patch is against PHP5. Barring any objections please apply the patch for PHP 5.0.3. Thanks
-- Markus Bertheau <twanger@bluetwanger.de>

John Coggeshall

21 years ago
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r" ...... why would you silence the error for the parameter when this function requires a valid Postgres resource to do anything? John On Mon, 2004-11-08 at 07:44, Markus Bertheau wrote:

Markus Bertheau

21 years ago
В Пнд, 08.11.2004, в 16:04, John Coggeshall пишет:
> if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() > TSRMLS_CC, "r" ...... > > why would you silence the error for the parameter when this function > requires a valid Postgres resource to do anything?
I copied the behaviour from pg_result_error(), so the answer is because pg_result_error() does it too. Markus
-- Markus Bertheau <twanger@bluetwanger.de>

Ilia A.

21 years ago
The error functions do so because they are likely to be called if creation of a connection fails so there may not always be a valid resource. The state checking function would presumably be only run on a valid connection and consequently should be strict about the resource parameter (IMO). Ilia Markus Bertheau wrote:

Markus Bertheau

21 years ago
В Пнд, 08.11.2004, в 16:33, Ilia Alshanetsky пишет:
> The error functions do so because they are likely to be called if > creation of a connection fails so there may not always be a valid > resource. The state checking function would presumably be only run on a > valid connection and consequently should be strict about the resource > parameter (IMO).
Both function take result resources, not connection resources. Markus
-- Markus Bertheau <twanger@bluetwanger.de>

Ilia A.

21 years ago
Same logic is applicable, in the event of failure false or invalid resource maybe returned. Ilia Markus Bertheau wrote: