<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#000080>Okay, I've got this now:</FONT></DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080>> con = sqlite3.connect(":memory:")<BR>> cur =
con.cursor()<BR>> cur.execute("""CREATE TABLE db.table(col.a integer, col.b
text)""")<BR>> con.executemany("""INSERT INTO db.table(col.a,
col.b) VALUES (?, ?)""", m)<BR>> con.commit()<BR></DIV>
<DIV></FONT><FONT color=#000080>> for row in con.execute("""SELECT col.a,
col.b FROM db.table"""):<BR>> print
row</FONT></DIV>
<DIV><FONT color=#000080>> # when run, all rows are printed correctly but as
unicode strings</FONT></DIV>
<DIV><FONT color=#000080>> q = "dog"<BR>> for row in con.execute("""SELECT
col.b FROM db.table WHERE col.b LIKE ? LIMIT 25""",
q):<BR>> print row<BR></DIV></FONT>
<DIV><FONT color=#000080>... And, I get the following error:</FONT></DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080>Traceback (most recent call last):</FONT></DIV>
<DIV><FONT color=#000080> for row in
con.execute("SELECT col.b FROM db.table WHERE col.b LIKE ? LIMIT
25", q):<BR> ProgrammingError: Incorrect number of bindings
supplied. The current statement uses 1, and there are 3 supplied.</FONT></DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080>As Python/pysqlite stores the items in the db.table as
unicode strings, I've also run the code with q=u"dog" but get the same error.
Same with putting the q as a tuple ie. (q) in the Select statement. Btw,
there are 73 instances of the substring 'dog' in db.table. </FONT></DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080>Cheers</FONT></DIV>
<DIV><FONT color=#000080></FONT> </DIV>
<DIV><FONT color=#000080>Dinesh</FONT></DIV>
<DIV><FONT color=#000080></FONT> </DIV></BODY></HTML>