summaryrefslogtreecommitdiff
path: root/django/db/models/sql
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2011-03-14 19:49:53 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2011-03-14 19:49:53 +0000
commitfd2f18008caeca28c60c43cce7b43fb87c6fee78 (patch)
tree0b8379fa6a746954811b76e022c182fc6cb62354 /django/db/models/sql
parentf1f10a9ce2d8cd8df0dbd4b922fd2dba335a3770 (diff)
Fixed #14733: no longer "validate" .raw() queries.
Turns out that a lot more than just SELECT can return data, and this list is very hard to define up front in a cross-database manner. So let's just assume that anyone using raw() is at least halfway competant and can deal with the error messages if they don't use a data-returning query. Thanks to Christophe Pettus for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql')
-rw-r--r--django/db/models/sql/query.py6
1 files changed, 0 insertions, 6 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 8fa3419059..ea89771ed1 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -31,7 +31,6 @@ class RawQuery(object):
"""
def __init__(self, sql, using, params=None):
- self.validate_sql(sql)
self.params = params or ()
self.sql = sql
self.using = using
@@ -62,11 +61,6 @@ class RawQuery(object):
return [converter(column_meta[0])
for column_meta in self.cursor.description]
- def validate_sql(self, sql):
- if not sql.lower().strip().startswith('select'):
- raise InvalidQuery('Raw queries are limited to SELECT queries. Use '
- 'connection.cursor directly for other types of queries.')
-
def __iter__(self):
# Always execute a new query for a new iterator.
# This could be optimized with a cache at the expense of RAM.