From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: libpq: bind message supplies 2 parameters, but prepared statement requires 1 |
Date: | 2006-07-02 21:28:25 |
Message-ID: | 20060702212825.GD8316@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
From | Date | Subject | |
---|---|---|---|
Next Message | Chris | 2006-07-02 23:54:22 | Re: Installation problems |
Previous Message | Martijn van Oosterhout | 2006-07-02 21:26:56 | Re: different sort order in windows and linux version |