When I look at generated sql from connection.queries, it doesn't show
any quotes around strings.

For example:
>>> from django.db import connection
>>> from django.contrib.auth.models import User
>>> User.objects.filter(username="bob")
[]
>>> connection.queries[-1]
{'time': '0.000', 'sql': u'SELECT `auth_user`.`id`,
`auth_user`.`username`, `auth_user`.`first_name`,
`auth_user`.`last_name`, `auth_user`.`email`, `auth_user`.`password`,
`auth_user`.`is_staff`, `auth_user`.`is_active`,
`auth_user`.`is_superuser`, `auth_user`.`last_login`,
`auth_user`.`date_joined` FROM `auth_user` WHERE
`auth_user`.`username` = bob  ORDER BY `auth_user`.`username` ASC'}
>>>

As one would imagine, when I execute:

mysql> SELECT `auth_user`.`id`, `auth_user`.`username`,
`auth_user`.`first_name`, `auth_user`.`last_name`,
`auth_user`.`email`, `auth_user`.`password`, `auth_user`.`is_staff`,
`auth_user`.`is_active`, `auth_user`.`is_superuser`,
`auth_user`.`last_login`, `auth_user`.`date_joined` FROM `auth_user`
WHERE `auth_user`.`username` = bob  ORDER BY `auth_user`.`username`
ASC;

It complains with "Unknown column 'bob' in 'where clause'".

It's obvious how I would change that code to execute properly, but I'd
like to know exactly what query django is building.
(for example you can get away with passing a number into a query
against a varchar, and that can affect the efficiency of complex
queries)

Is this Django-MySQL 5.x specific?  Is this a full-on django bug?

Regards.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to