libpq Prepared Statement with dynamic IN operator

Поиск
Список
Период
Сортировка
От Dave Greeko
Тема libpq Prepared Statement with dynamic IN operator
Дата
Msg-id 418457940.732204.1606245243551@mail.yahoo.com
обсуждение исходный текст
Ответы Re: libpq Prepared Statement with dynamic IN operator  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
Dear All,
I am having a hard time figuring out how prepare and execute a Prepared Statement with an "IN" operator in the WHERE clause using libpq. The total elements that will be passed to IN operator is dynamic and varied at runtime.
here is an example query:

select payload_id,ptime,frequency from codecs where tag IN (‘G729’,’GSM’);

The number of elements to filter for with this particular example is 2 but this varies at runtime (between 1 to 127 elements).
I would like to know what’s the proper syntax of the (char *query) parameter when calling the PQprepare() function.
I tried “select payload_id,ptime,frequency from codecs where tag=ANY(?)” but failed

Regards,
Dave

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

Предыдущее
От: Ron
Дата:
Сообщение: Re: Performance hit if I create multiple DBs on same instance
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: libpq Prepared Statement with dynamic IN operator