Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id C614663256C for ; Wed, 19 Aug 2009 18:11:43 -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 27311-07 for ; Wed, 19 Aug 2009 21:11:28 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.potentialtech.com (internet.potentialtech.com [66.167.251.6]) by mail.postgresql.org (Postfix) with ESMTP id 19AA363248B for ; Wed, 19 Aug 2009 18:11:33 -0300 (ADT) Received: from localhost (pr40.pitbpa0.pub.collaborativefusion.com [206.210.89.202]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.potentialtech.com (Postfix) with ESMTPSA id BD8D4EBC0A; Wed, 19 Aug 2009 17:11:29 -0400 (EDT) Date: Wed, 19 Aug 2009 17:11:27 -0400 From: Bill Moran To: Eric Chamberlain Cc: Subject: Re: Stored procedures, PDO, and PHP issue Message-Id: <20090819171127.57b19e4c.wmoran@potentialtech.com> In-Reply-To: References: Organization: Bill Moran X-Mailer: Sylpheed 2.7.0 (GTK+ 2.16.5; i386-portbld-freebsd7.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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/13 X-Sequence-Number: 4054 In response to Eric Chamberlain : > I'm having an issue calling a specific stored proc using PHP and PDO. > I have two procs with the same name and same number of parameters. > However, the parameter types are different. When the below code is > called in PHP it always calls the varchar, varchar proc. I can not > get it to call the integer, varchar proc. > > Stored procedure definitions: > boolean is_password_expired(i_user varchar, i_pass varchar) > boolean is_password_expired(i_user_id integer, i_pass varchar) > > $stmt = $db->prepare("SELECT is_password_expired(?, ?)"); > $stmt->bindValue(1, $userId, $hashPass, PDO::PARAM_INT); > $stmt->execute(); > > This always returns false because it's passing the $userId, of say > "1", to the varchar, varchar proc. I've tried using the following: > > $stmt = $db->prepare("SELECT > is_password_expired(?::integer, ?::varchar)"); > > This completely fails. > > $stmt->bindParam(1, $userId, $hashPass, PDO::PARAM_INT); > > Same as bindValue result. > > $stmt->execute(array($userId, $hashPass)); > > Same result. > > Is there some way to inform PDO and Postgresql that I plan on using > the integer, varchar proc? If so, how do I do this? Thanks all! I would expect what you're doing to work. It works with the functional interface. What do the query logs on the server say? Try turning full query logging on and see what's actually getting run. I see in another reply that you're getting a blank white screen. This tends to suggest that your debugging is configured wrong, or that PHP is encountering a fatal error and coredumping or something similar. Check whatever logs are appropriate for evidence of this. Check the HTTP error log, as well as system error logs. -- Bill Moran http://www.potentialtech.com http://people.collaborativefusion.com/~wmoran/