Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 39B79633548 for ; Mon, 3 Aug 2009 19:50:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 03985-02-6 for ; Mon, 3 Aug 2009 22:50:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-px0-f190.google.com (mail-px0-f190.google.com [209.85.216.190]) by mail.postgresql.org (Postfix) with ESMTP id 7F004635999 for ; Mon, 3 Aug 2009 19:50:25 -0300 (ADT) Received: by pxi28 with SMTP id 28so2515367pxi.28 for ; Mon, 03 Aug 2009 15:50:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=vbt08kl+x/8CGWCG4/Fa86MiZ0RTQlCBY/vXLb4sWsI=; b=bk+Crsm3DK911GrMIBSo4zymKOFFgI0bEzM7a01x+PLTP6cBIjGTCuYUnD/sa+IFy5 bh6wSep13djCthaCabS8M4ppcVStyGkpYK9t2f0ZEEjFMDP3xW6bmFLNfUBWHjEi8Rgu 5YRcFfFlBvMm4MZCuXb9fpDLwrrNU7nVeobVc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=xgiABghVDMBvJrnsMiq17qPrGUFMgQjQi8ulXRfsyBBntjjoTyWbeTikjHAJfYLYrX 93FWzh8E3fqb5Yg4eZ9MCjXeJkIrkOTRKTQEBLGF+7NLoTqVkwhVEziaGt5j8S54NWhU WIfqw6TJgAa6k93bqsJI11HqPcdd2wx1PPsj8= Received: by 10.114.39.18 with SMTP id m18mr8794326wam.214.1249339823952; Mon, 03 Aug 2009 15:50:23 -0700 (PDT) Received: from ?192.168.2.65? (office.squiz.net [203.206.128.174]) by mx.google.com with ESMTPS id j15sm11719824waf.51.2009.08.03.15.50.21 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 03 Aug 2009 15:50:22 -0700 (PDT) Message-ID: <4A7769A9.6020205@gmail.com> Date: Tue, 04 Aug 2009 08:50:17 +1000 From: Chris User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: Andreas Kalsch CC: pgsql-php@postgresql.org Subject: Re: PDO does not trow Exceptions for queries References: <4A772E6F.1000108@gmx.de> In-Reply-To: <4A772E6F.1000108@gmx.de> 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=-1.728 tagged_above=-10 required=5 tests=AWL=0.871, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/6 X-Sequence-Number: 4047 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. -- Postgresql & php tutorials http://www.designmagick.com/