sqlite parameter transformation problem
using sqlite3 python 2.5, i'm perplexing iterate by list lift weight an vigilant database formed item's name.
i attempted controlling "?" parameter transformation suggested hinder sql injections nonetheless doesn't work. example, i use:
for vigilant self.inventory_names:
self.cursor.execute("select weight apparatus where name = ?", item)
self.cursor.close()
i error:
sqlite3.programmingerror: crude array bindings supplied. tide matter uses 1, there 8 supplied.
i trust somehow caused initial origination database; way i finished indeed creates db does have 8 bindings.
cursor.execute("""create list apparatus
(id integer primary key,
name text,
cost integer,
weight real,
info text,
ammo_cap integer,
availability_west text,
availability_east text)""")
however, i less-secure "%s" transformation any vigilant name, works only fine. so:
for vigilant self.inventory_names:
self.cursor.execute("select weight apparatus where name = '%s'" % item)
self.cursor.close()
i can't figure out since thinks i have 8 bindins i'm wholly job one. i repair it?
Comments
Post a Comment