Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 08978634384 for ; Mon, 3 Aug 2009 20:05:00 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 95312-01 for ; Mon, 3 Aug 2009 23:04:49 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from anni.mesolt.eu (anni.mesolt.eu [78.46.68.173]) by mail.postgresql.org (Postfix) with ESMTP id 1B5C0634142 for ; Mon, 3 Aug 2009 20:04:48 -0300 (ADT) Received: from [192.168.2.127] (p4FCE5AD6.dip.t-dialin.net [79.206.90.214]) by anni.mesolt.eu (Postfix) with ESMTP id 0C24A2AFCBCC for ; Tue, 4 Aug 2009 01:17:08 +0200 (CEST) Message-ID: <4A776D0D.4040707@gmx.de> Date: Tue, 04 Aug 2009 01:04:45 +0200 From: Andreas Kalsch User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: pgsql-php@postgresql.org Subject: Re: PDO does not trow Exceptions for queries References: <4A772E6F.1000108@gmx.de> <4A7769A9.6020205@gmail.com> In-Reply-To: <4A7769A9.6020205@gmail.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/7 X-Sequence-Number: 4048 In this case it was my false - I forgot to enable error reporting on the PHP side. Now everything works like I would expect it. Chris schrieb: > Andreas Kalsch wrote: >> $C->DB is my connection, but no exceptions will be thrown for the >> last queries - althogh there is an error (whoch the command line >> would show). >> Is there another option to activate throwing of exceptions? >> >> >> $C->DB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); >> >> $C->DB->query('DROP TABLE key'); >> >> $C->DB->query('CREATE TABLE key ( id SERIAL NOT NULL PRIMARY KEY, k >> TEXT NOT NULL UNIQUE )'); >> >> $S = $C->DB->prepare('INSERT INTO key (k) >> SELECT lower(k) FROM current_node_tags LIMIT 100'); > > prepare returns a 'pdostatement' which you then have to execute: > > $S->execute(); > > This should generate an exception. >