Re: libpq: bind message supplies 2 parameters, but prepared statement requires 1

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: libpq: bind message supplies 2 parameters, but prepared statement requires 1
Дата
Msg-id 20060702212825.GD8316@svana.org
обсуждение исходный текст
Ответ на libpq: bind message supplies 2 parameters, but prepared statement requires 1  ("Alexander Farber" <alexander.farber@gmail.com>)
Список 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.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: different sort order in windows and linux version
Следующее
От: Chris
Дата:
Сообщение: Re: Installation problems