Edgewall Software

Changes between Version 29 and Version 30 of TracDev/DatabaseApi


Ignore:
Timestamp:
Apr 5, 2014, 1:09:45 PM (10 years ago)
Author:
Jun Omae
Comment:

Revised example to use db.quote()

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/DatabaseApi

    v29 v30  
    220220cursor.execute("SELECT author,ipnr,comment FROM wiki WHERE name=%s", [thename])
    221221cursor.execute("SELECT id FROM ticket WHERE time>=%s AND time<=%s", (start, stop))
    222 
    223222}}}
    224223
     
    228227cursor.execute("SELECT author,ipnr,comment FROM wiki WHERE name=?", thename)
    229228cursor.execute("SELECT id FROM ticket WHERE time>=%i AND time<=%i", start, stop)
    230 
    231229}}}
    232230
     
    237235{{{
    238236#!python
    239 cursor.execute("SELECT time FROM %s WHERE name=%%s" % table, (thename,))
    240 
     237cursor.execute("SELECT time FROM %s WHERE name=%%s" % db.quote(table), (thename,))
    241238}}}
    242239