Re: DML value format

Поиск
Список
Период
Сортировка
От Kev
Тема Re: DML value format
Дата
Msg-id 1186747639.775251.131750@x40g2000prg.googlegroups.com
обсуждение исходный текст
Ответ на [PROPOSAL] DML value format  (Alejandro Torras <atec_post@yahoo.es>)
Список pgsql-general
On Aug 10, 6:56 am, atec_p...@yahoo.es (Alejandro Torras) wrote:
> -- English --
> Hi,
>
> Is there some way to put values in a INSERT statement
> without taking care of apostrophes?
>
> In example:
> INSERT INTO persons VALUES ('Harry', 'O'Callaghan');
>                                       ^^^^^^^^^^^
>
> I think that it can be used some kind of length-marker
> to help the parsing of the value.
>
> In example:
> INSERT INTO persons VALUES ('Harry', @11:O'Callaghan);
>
> I think this approach could help reducing the sql
> injections.

If you're worried about sql injections, I'm not sure what kind of
client library you're using to access your pgsql database, but most of
them should have placeholder capability, I think, which definitely
takes care of that.  Your statement would become INSERT INTO persons
VALUES (?, ?) and then you would pass the execution function your two
values and it would escape them properly for you.  At least that's how
it works with Perl and DBI.

Kev


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

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: serial grows on failed requests
Следующее
От: "Eric Rasoa"
Дата:
Сообщение: Postgres : Close cursor / PerformPortalClose