I have this line that works OK:
c.execute('select cleanseq from cleanseqs WHERE newID="%s"'%name)
But I want to use SQLite parameter substitution instead instead of string substitution (because I see here that this is safer).
This is my (failed) try:
t = (name,)
c.execute('select cleanseq from cleanseqs WHERE newID="?"',t)
But this line returns:
'Incorrect number of bindings
supplied. The current statement uses
0, and there are 1 supplied.'
So the left part of my statement doesn't work. I am supplying one binding (name, in t) but seems that the question mark (?) is not being parsed. If I delete the quotes sourronding the ?, it works. But I want the quotes to remain there since I remember that there are cases where I need them.
So the question is: How do I convert this line:
c.execute('select cleanseq from cleanseqs WHERE newID="%s"'%name)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…