【发布时间】:2016-11-10 03:03:29
【问题描述】:
在下面的代码中,我想通过定位link插入authors。
self.cur.execute("""
UPDATE articles
SET authors = %s
WHERE link = %s returning id;
""" % (authors, link))
ret_id = self.cur.fetchone()
并且遇到了两个问题:
-
有些名字不规则,像这样:
LINE 1: UPDATE articles SET authors = Francesco D'Angelo, Roberto T... -
当作者姓名没问题时:
"""UPDATE articles SET authors = %s WHERE link = %s returning id;""" % (authors, link)) psycopg2.ProgrammingError: syntax error at or near ":" LINE 1: ...DATE articles SET authors = test WHERE link = http://www.wor...
【问题讨论】:
标签: python postgresql parameter-passing sql-injection psycopg2