Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9459A6368D3 for ; Wed, 19 Aug 2009 17:26:23 -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 19515-01-2 for ; Wed, 19 Aug 2009 20:26:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.zonarsystems.com (mail.zonarsystems.com [72.37.234.108]) by mail.postgresql.org (Postfix) with ESMTP id E3D06635361 for ; Wed, 19 Aug 2009 17:26:09 -0300 (ADT) Received: from eric-mbp.zcorp.zonarsystems.com (10.0.1.22) by mail.zonarsystems.com (10.0.0.23) with Microsoft SMTP Server (TLS) id 8.1.393.1; Wed, 19 Aug 2009 13:27:46 -0700 Message-ID: <94F29381-7904-4A59-9ECC-E6FC8CE2A90E@zonarsystems.com> From: Eric Chamberlain To: Content-Type: multipart/alternative; boundary="Apple-Mail-40--324054857" MIME-Version: 1.0 (Apple Message framework v936) Subject: Overloaded stored procedures, PDO, and PHP issue Date: Wed, 19 Aug 2009 13:26:08 -0700 X-Mailer: Apple Mail (2.936) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200908/9 X-Sequence-Number: 4050 --Apple-Mail-40--324054857 Content-Type: text/plain; charset="US-ASCII"; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit 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! Eric --Apple-Mail-40--324054857 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable
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 =3D = $db->prepare("SELECT is_password_expired(?, = ?)");
$stmt->bindValue(1, $userId, $hashPass, = PDO::PARAM_INT);
$stmt->execute();

T= his always returns false because it's passing the $userId, of say "1", = to the varchar, varchar proc.  I've tried using the = following:

$stmt =3D $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!

Eric
= --Apple-Mail-40--324054857--