我在 sqlite3 的文件中搜索时遇到问题,我有一个包含以下列的数据库:标题,艺术家,歌词,跟踪
我的代码是:
def search(title,artist,query):
if title and artist and query:
db = sqlite3.connect('songs.db')
cursor = db.cursor()
cursor.execute('SELECT ? FROM song WHERE title=? and artist=?',(query,title,artist))
result = cursor.fetchall()
if result:
print result
else:
return False
我已将 text_factory 设置为 str,但它解决了我遇到的另一个问题,我使用 sqliteman 之类的查看器检查了数据库,并尝试通过终端进行搜索,它运行良好。¿ 任何人都可以看到有什么问题吗?