Re: libpq Prepared Statement with dynamic IN operator

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: libpq Prepared Statement with dynamic IN operator
Дата
Msg-id 310537.1606252691@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: libpq Prepared Statement with dynamic IN operator  (Dave Greeko <davegreeko@yahoo.com>)
Ответы Re: libpq Prepared Statement with dynamic IN operator  (Dave Greeko <davegreeko@yahoo.com>)
Список pgsql-general
Dave Greeko <davegreeko@yahoo.com> writes:
> I tried both and I am getting syntax error.

> char *query="select codec_id,fs_name,pt from codec_defs where pt = ANY(string_to_array(?, ','))";
> OR
> char *query="select codec_id,fs_name,pt from codec_defs where pt = ANY(?::text)";

> PGresult *res=PQprepare(conn,"codecs",query,1,NULL);

Well, your first problem is that "?" is not the parameter symbol
understood by libpq+backend.  Try "$1".  The other problem,
at least for the second version of that, is that you want to be
passing a text array not a single text value --- so it needs to
look more like "where pt = ANY($1::text[])".

            regards, tom lane



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

Предыдущее
От: Dave Greeko
Дата:
Сообщение: Re: libpq Prepared Statement with dynamic IN operator
Следующее
От: Dave Greeko
Дата:
Сообщение: Re: libpq Prepared Statement with dynamic IN operator