Concern over ext/pgsql API

From: Date: Thu, 31 Mar 2005 07:07:24 +0000
Subject: Concern over ext/pgsql API
Groups: php.internals 
Request: Send a blank email to internals+get-15697@lists.php.net to get a copy of this message
Hi, There is a nasty problem with using the new sqlstate codes in the PostgreSQL extension. Say you want to find the sqlstate error code of a query that fails, the function prototype is: $sqlstate = pg_result_error_field($result, PGSQL_DIAG_SQLSTATE); HOWEVER, it is not possible to get a result resource from a failed pg_query! pg_query() returns FALSE on failure, not a result. The only way to get the result is to use the asynchronous interface, which basically no-one does. What should we do? I can perhaps store a per-connection sqlstate after each query, but what about all the other error fields: PGSQL_DIAG_SEVERITY, PGSQL_DIAG_MESSAGE_PRIMARY, PGSQL_DIAG_MESSAGE_DETAIL, PGSQL_DIAG_MESSAGE_HINT, PGSQL_DIAG_STATEMENT_POSITION, PGSQL_DIAG_INTERNAL_POSITION (PostgreSQL 8.0+ only), PGSQL_DIAG_INTERNAL_QUERY (PostgreSQL 8.0+ only), PGSQL_DIAG_CONTEXT, PGSQL_DIAG_SOURCE_FILE, PGSQL_DIAG_SOURCE_LINE or PGSQL_DIAG_SOURCE_FUNCTION ??? Chris

« previous php.internals (#15697) next »