[IronPython] Making adonet-dbapi's dbapi a drop-in replacement in django-mssql
mjt at nysv.org
Tue Oct 27 15:20:42 CET 2009
On Tue, Oct 27, 2009 at 08:01:47AM -0600, Jeff Hardy wrote:
>2009/10/27 Markus Törnqvist <mjt at nysv.org>:
>Well, you can inore my previous email :)
We'll see, if this becomes way too heavy, I might get back to sqlite
for a while ;)
>> Environment Error: System.Data.SqlClient.SqlException: Incorrect syntax near 's'.
>It's the %s parameter markers that Django uses; they need to be
>converted to whatever SQL Server uses (Vernon would probably know
>better then me). The easiest way is query % params; building the
>params tuple is the hard part. It's been a while since I looked at the
>mssql.py code, so I don't remember the details.
Yeah, the regular sqlite, for example, replaces the %s stuff with ?,
which MSSQL should imo do too.
However, you construct this:
command = self.connection.connection.CreateCommand()
and start putting parameters in there, which makes me think I shouldn't
do query % params after all, but that it executes it from a kind of a
.net object or somesuch.
I tried of course duplicating all the %s's in the query to ?s but that
didn't help me out.
mssql.py is sort of weird.
The connect() function returns generic_connect() from dbapi.generic.
There is tuple replacement in mssql's class Cursor, method execute, which
looks a lot more familiar.
Now is there some chance that it's just broken, that it instantiates the
wrong kind of cursor which calls, naturally, the wrong execute() method?
Maybe I should look into that?
More information about the Ironpython-users