Okay, I've got this now:
> con = sqlite3.connect(":memory:")
> cur = con.cursor()
> cur.execute("""CREATE TABLE db.table(col.a integer, col.b text)""")
> con.executemany("""INSERT INTO db.table(col.a, col.b) VALUES (?, ?)""", m)
> con.commit()
> for row in con.execute("""SELECT col.a, col.b FROM db.table"""):
> print row
> # when run, all rows are printed correctly but as unicode strings
> q = "dog"
> for row in con.execute("""SELECT col.b FROM db.table WHERE col.b LIKE ? LIMIT
> 25""", q):
> print row
.. And, I get the following error:
Traceback (most recent call last):
for row in con.execute("SELECT col.b FROM db.table WHERE col.b LIKE ? LIMIT
25", q):
ProgrammingError: Incorrect number of bindings supplied. The current
statement uses 1, and there are 3 supplied.
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.
Cheers
Dinesh
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor