Ok, so I have a function that selects certain rows in a sqlite database based on input from a plugin. I got the plugin to select and fetch rows when just one statement is involved, but since I want to add some flexibility to this, I tried making the function use executemany when encountering lists or tuples. Yet, despite all the things I have fiddled and changed, I a still unable to get this to work, either because the sqlite statement is treating each character in the string as a binding, or because there are too many bindings in the tuple. Here's the code I have so far:
def readoffset(self,offset):
vartype = type(name)
print(vartype)
if vartype == int:
self.memcursor.execute('''select all id,matbefore,matafter,name,date
from main as main where id = ?''',[offset])
undolist = self.memcursor.fetchall()
print(undolist)
return(undolist)
elif vartype == tuple or list:
print(vartype)
self.memcursor.executemany('''select all id,matbefore,matafter,name,date
from main as main where name = (?)''', [offset])
undolist = self.memcursor.fetchall()
return(undolist)