QuoteSQL

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Mon Sep 25 03:28:51 EDT 2006


Lawrence D'Oliveiro enlightened us with:
>         "select * from details where person_name like"
>         " concat(\"%%\", %s, \"%%\")" \
>     % \
>         QuoteSQL(name, True)

Wouldn't this be a whole lot better?

cursor.execute(
    "select * from details where person_name like ?",
    '%' + name + '%'
)

Sybren
-- 
Sybren Stüvel
Stüvel IT - http://www.stuvel.eu/



More information about the Python-list mailing list