X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3C658D1E965 for ; Tue, 2 Mar 2004 00:18:27 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 60378-01 for ; Mon, 1 Mar 2004 20:18:28 -0400 (AST) Received: from seahorse.shentel.net (seahorse.shentel.net [204.111.11.44]) by svr1.postgresql.org (Postfix) with ESMTP id 6DFABD1E95E for ; Mon, 1 Mar 2004 20:18:22 -0400 (AST) Received: from shentel.net (ha30s457.d.shentel.net [204.111.30.201]) by seahorse.shentel.net (8.11.7/8.11.7) with ESMTP id i220IM416369 for ; Mon, 1 Mar 2004 19:18:23 -0500 Message-ID: <4043D06D.5050205@shentel.net> Date: Mon, 01 Mar 2004 19:08:13 -0500 From: Paul Tillotson User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-php@postgresql.org Subject: Re: SQLSTATE in PHP? References: <45EF7AF0-6B63-11D8-89E9-000A95C88220@myrealbox.com> In-Reply-To: <45EF7AF0-6B63-11D8-89E9-000A95C88220@myrealbox.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/12 X-Sequence-Number: 2611 No native function that I know of. If it is important you could emulate it using the error handler. I.e., define a custom error handler which looks at the error string for the error, finds the SQL STATE code, and saves that somewhere. Then you can write another function which returns this saved variable and name it my_pg_last_error() or whatever. Michael Glaesemann wrote: > Hey all, > > I've been looking for a way to get the SQLSTATE PostgreSQL error code > from within PHP to build better error-handling within my web > front-ends. However, I've been unable to find anything. There is > similar functionality for MySQL in the PHP mysqli_sqlstate() function. > > Anyone know of a way to get these error codes from within PHP? Or is > this a missing feature in PHP's PostgreSQL support? > > Thanks for any feedback. > > Michael Glaesemann > grzm myrealbox com > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > >