Re: PQexecParams, placeholders and variable lists of params

Поиск
Список
Период
Сортировка
От tomas@tuxteam.de
Тема Re: PQexecParams, placeholders and variable lists of params
Дата
Msg-id YZz4ySpB8OMYjAEz@tuxteam.de
обсуждение исходный текст
Ответ на Re: PQexecParams, placeholders and variable lists of params  (Дмитрий Иванов <firstdismay@gmail.com>)
Ответы Re: PQexecParams, placeholders and variable lists of params
Список pgsql-general
On Tue, Nov 23, 2021 at 06:39:27PM +0500, Дмитрий Иванов wrote:
> Hi
> A function cannot have an undefined signature, but can accept an array of
> arguments:

I see. So you propose passing an array as a single param to
PQexecParams, in PostgreSQL's syntax for arrays, e.g.. "{42, 45, 50}".

Makes sense. Problem is, that, again, the application would be
responsible of making sure the individual values don't contain nasty
stuff (for example, if they are strings) before consolidating them to
one PostgreSQL array literal.

I was hoping to get away "on the cheap" on this, letting PostgreSQL take
care of the injection avoidance ;-)

I'm converging in building the query dynamically, but still with
placeholders. I /know/ how many values are coming, and how many
placeholders used so-far in the query, so it'd be fairly easy to just
insert "$m"..."$n" as needed.

Thanks a lot, Dmitri

Cheers
 - t

Вложения

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

Предыдущее
От:
Дата:
Сообщение: Re: Regex for Word space Word space Word ....
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Regex for Word space Word space Word ....