我试图使用Python的Sqlite库进行参数化LIKE查询,如下所示:
self.cursor.execute("select string from stringtable where string like '%?%' and type = ?", (searchstr,type))
Run Code Online (Sandbox Code Playgroud)
但是?没有评估通配符内部,但是我发现此错误:
"sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 2 supplied."
Run Code Online (Sandbox Code Playgroud)
我还尝试使用标记版本的查询:
like '%:searchstr%' 并在列表中 {"searchstr":searchstr...
但是,当我这样做时,查询运行但从不返回任何结果,即使手动"like '%a%'"...返回数百个结果应该
有什么建议吗?