On Sat, 2007-08-11 at 04:25 -0400, Mike Meyer wrote: > On Fri, 10 Aug 2007 20:24:17 -0400 Carsten Haese <[EMAIL PROTECTED]> wrote: > > As I said, there is a defined way: Don't treat things that look like > > parameter markers as parameter markers if they appear inside > > apostrophes. This may require a simple parser in the API module, but I > > prefer placing a burden on a dozen API module authors over placing a > > burden on thousands of application developers. > > Well, that's a way. The problem is, it's not defined in the PEP. Other > modules don't do that (since pysqlite is bundled these days, it's easy > to verify that indeed, it doesn't behave this way).
Sure, let's verify: >>> import sqlite3 >>> conn = sqlite3.connect(":memory:") >>> cur = conn.cursor() >>> cur.execute("create table t1(c1 varchar(20))") <sqlite3.Cursor object at 0xb7ecec20> >>> cur.execute("insert into t1(c1) values('?')") <sqlite3.Cursor object at 0xb7ecec20> >>> cur.execute("select * from t1").fetchall() [(u'?',)] >>> cur.execute("insert into t1(c1) values(?)") Traceback (most recent call last): File "<stdin>", line 1, in <module> sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 0 supplied. Maybe I'm misunderstanding what you mean by "behave this way", but it certainly looks like it's doing what I described as "Don't treat things that look like parameter markers as parameter markers if they appear inside apostrophes." -- Carsten Haese http://informixdb.sourceforge.net _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig