# [PATCH] pg_result_sqlstate

- Thread: https://externals.io/message/13787
- Original archive: https://news-web.php.net/php.internals/13787
- Started by Markus Bertheau on 2004-11-08T12:44:31+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #13787 — Markus Bertheau — 2004-11-08T12:44:31+00:00

URL: https://externals.io/message/13787#13787

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

---

## #13788 — John Coggeshall — 2004-11-08T15:04:51+00:00

URL: https://externals.io/message/13787#13788 · In reply to: #13787

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


> 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

---

## #13789 — Markus Bertheau — 2004-11-08T15:24:05+00:00

URL: https://externals.io/message/13787#13789 · In reply to: #13788

В Пнд, 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

---

## #13790 — Ilia Alshanetsky — 2004-11-08T15:33:18+00:00

URL: https://externals.io/message/13787#13790 · In reply to: #13789

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:
> В Пнд, 08.11.2004, в 16:04, John Coggeshall пишет:
> 
> > […]
> 
> 
> I copied the behaviour from pg_result_error(), so the answer is because
> pg_result_error() does it too.
> 
> Markus

---

## #13791 — Markus Bertheau — 2004-11-08T15:41:58+00:00

URL: https://externals.io/message/13787#13791 · In reply to: #13790

В Пнд, 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

---

## #13792 — Ilia Alshanetsky — 2004-11-08T15:46:00+00:00

URL: https://externals.io/message/13787#13792 · In reply to: #13791

Same logic is applicable, in the event of failure false or invalid 
resource maybe returned.

Ilia

Markus Bertheau wrote:
> В Пнд, 08.11.2004, в 16:33, Ilia Alshanetsky пишет:
> 
> > […]
> 
> 
> Both function take result resources, not connection resources.
> 
> Markus
