| От | Pierre-Frédéric Caillaud |
|---|---|
| Тема | Re: Sql injection attacks |
| Дата | |
| Msg-id | opsbr90lipcq72hf@musicbox обсуждение исходный текст |
| Ответ на | Re: Sql injection attacks (Tom Allison <tallison@tacocat.net>) |
| Список | pgsql-general |
Python has an interface like this :
params = { 'mystrfield': 'hello', 'myintfield': 5 }
cursor.execute( "SELECT myfield FROM mytable WHERE
mystrfield=%(foo)s AND myintfield=%(bar)d;" , params )
It has the following advantages :
- separation of sql from data
- named parameters
- no problem with order
- one parameter can be reused several times
- automatic escaping of strings
- automatic enforcement of int, float etc types with %d and %f (throws an
exception otherwise)
The only problem so far with Python's dbapi is that it does not
understand arrays so they have to be stringified first.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера