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@xxxxxxxxx> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.
Attachment:
signature.asc
Description: Digital signature