Hi!
Sometimes we all get sql errors from our code. Nevertheless the traceback
kind of
File "/usr/lib/python2.4/site-packages/django/db/models/query.py", line 242,
in count
cursor.execute("SELECT COUNT(*)" + sql, params)
File "/usr/lib/python2.4/site-packages/django/db/backends/util.py", line 19,
in execute
return self.cursor.execute(sql, params)
File "/usr/lib/python2.4/site-packages/django/db/backends/sqlite3/base.py",
line 95, in execute
return Database.Cursor.execute(self, query, params)
OperationalError: near "?": syntax error
isn't quite informative.
What I would like is to have sql clause and params in the exception I get.
The only thing that needs to be modified is *CursorWrapper.execute for each
backend. Just like this for SQLiteCursorWrapper:
def execute(self, query, params=()):
query = self.convert_query(query, len(params))
try:
return Database.Cursor.execute(self, query, params)
except Exception, e:
e.query = query
e.params = params
raise
Any reason for *not* doing this?
Would be such featurelet desireable?
If yes, I'll prepare a patch against the trunk.
--
Andrey V Khavryuchenko
Django NewGate - http://www.kds.com.ua/djiggit/
Development - http://www.kds.com.ua
Call akhavr1975 on www.gizmoproject.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---