Re: libpq: bind message supplies 2 parameters, but prepared statement requires 1 - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: libpq: bind message supplies 2 parameters, but prepared statement requires 1
Date
Msg-id 20060702212825.GD8316@svana.org
Whole thread Raw
In response to libpq: bind message supplies 2 parameters, but prepared statement requires 1  ("Alexander Farber" <alexander.farber@gmail.com>)
List pgsql-general
On Sun, Jul 02, 2006 at 11:17:12PM +0200, Alexander Farber wrote:

<snip>

> However when I try to execute the latter query by my C-program,
> then it fails, saying that my bind command supplies 2 arguments
> (yes, that's true), but the prepared statement requires 1 argument
> (why 1? I don't understand). I have prepared a separate simple
> test case, could someone please explain what am I doing wrong?
>
> #include <err.h>
> #include <stdio.h>
> #include <libpq-fe.h>
>
> #define DB_CONN_STR             "host=/var/www/tmp user=punbb dbname=punbb"
> #define SQL_FETCH_USERNAME      "select username from users " \
>    "where id = $1 and md5('deadbeef' || password) = '$2'"

You've got quotes around the $2, so it's seeing a string, not a
parameter.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: different sort order in windows and linux version
Next
From: Chris
Date:
Subject: Re: Installation problems