【发布时间】:2015-11-30 22:01:26
【问题描述】:
我很好奇,如何调试 SQLite3 语法。我每天都在使用这个 SQL,有时我会遇到无法修复的语法错误。
例如这个查询:
self.cur.execute("""INSERT INTO table(?,?,?,?,?,?,?,?,?,?,?,?,?) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)""", ('category', 'product_number', 'product', 'availability', 'manufacturer', 'weight', 'inner', 'outer', 'width', 'list_price', 'discount', 'gross_price', 'net_price', u'Wellenscheiben BKAGI..', 'BKAGI15', '-', 'This', 'PePS', '138,00', '50,00', '78,00', '6,50', '36,93', '55,00', '19,78', '16,62'))
sqlite3.OperationalError:靠近“?”:语法错误
你知道如何找出错误在哪里吗?
【问题讨论】:
-
您不能(也不应该)将查询参数用于标识符(表名和列名)。