On 1/10/06, Rich Bakos <[EMAIL PROTECTED]> wrote:
> Here is the exact SQL that is passed to MS SQL:
>
> SELECT
> [core_sessions].[session_key],[core_sessions].[session_data],[core_sessions].[expire_date]
> FROM [core_sessions] WHERE [core_sessions].[session_key] = %s
>
> As you can see, it has stopped at %s.
>
> Is there anything I can do to help?

Yes, help would be great, because I don't have access to a SQL Server
installation...

Here's what's happening. All Django queries use "%s" as placeholders
for values that will be quoted by the database backend. For example:

    cursor.execute("UPDATE foo set bar=%s", ['fred'])

The database backend translates this to:

    UPDATE foo set bar='fred'

Note that it properly applies quote marks as necessary.

The problem is that the SQL Server database backend (the "adodbapi"
library) assumes placeholders use "?" for placeholders. So the Django
layer needs to convert all "%s" placeholders in the query to "?".

It looks like the current way this is happening (in
django/core/db/backends/ado_mssql.py) isn't working. Could you tinker
with this and see what you can fix?

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Reply via email to