Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15697 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82248 invoked by uid 1010); 31 Mar 2005 07:06:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 82211 invoked from network); 31 Mar 2005 07:06:03 -0000 Received: from unknown (HELO sz-storage.com) (127.0.0.1) by localhost with SMTP; 31 Mar 2005 07:06:03 -0000 X-Host-Fingerprint: 203.22.197.21 houston.au.fhnetwork.com FreeBSD 4.6-4.9 Received: from ([203.22.197.21:3660] helo=houston.familyhealth.com.au) by pb1.pair.com (ecelerity HEAD r(5268)) with SMTP id 62/AB-22409-851AB424 for ; Thu, 31 Mar 2005 02:06:01 -0500 Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 3D51224FE0 for ; Thu, 31 Mar 2005 15:05:53 +0800 (WST) Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 1A8F024FCD for ; Thu, 31 Mar 2005 15:05:53 +0800 (WST) Message-ID: <424BA1AC.8000602@familyhealth.com.au> Date: Thu, 31 Mar 2005 15:07:24 +0800 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: php-dev Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Concern over ext/pgsql API From: chriskl@familyhealth.com.au (Christopher Kings-Lynne) 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