From b32aca5d8cbf999eedc3e9947d5d8392b13ad2ed Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 16 Dec 2005 05:16:48 +0000 Subject: [PATCH] magic-removal: Merged to [1688] git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1689 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/mysql/introspection.py | 3 ++- django/db/backends/postgresql/introspection.py | 4 +++- django/db/backends/sqlite3/introspection.py | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/django/db/backends/mysql/introspection.py b/django/db/backends/mysql/introspection.py index 28f3ac13ef..d33b5bbfe1 100644 --- a/django/db/backends/mysql/introspection.py +++ b/django/db/backends/mysql/introspection.py @@ -1,3 +1,4 @@ +from django.db.backends.mysql.base import quote_name from MySQLdb.constants import FIELD_TYPE def get_table_list(cursor): @@ -7,7 +8,7 @@ def get_table_list(cursor): def get_table_description(cursor, table_name): "Returns a description of the table, with the DB-API cursor.description interface." - cursor.execute("SELECT * FROM %s LIMIT 1" % table_name) + cursor.execute("SELECT * FROM %s LIMIT 1" % quote_name(table_name)) return cursor.description def get_relations(cursor, table_name): diff --git a/django/db/backends/postgresql/introspection.py b/django/db/backends/postgresql/introspection.py index 778a8e84cb..c06b523211 100644 --- a/django/db/backends/postgresql/introspection.py +++ b/django/db/backends/postgresql/introspection.py @@ -1,3 +1,5 @@ +from django.db.backends.postgresql.base import quote_name + def get_table_list(cursor): "Returns a list of table names in the current database." cursor.execute(""" @@ -11,7 +13,7 @@ def get_table_list(cursor): def get_table_description(cursor, table_name): "Returns a description of the table, with the DB-API cursor.description interface." - cursor.execute("SELECT * FROM %s LIMIT 1" % table_name) + cursor.execute("SELECT * FROM %s LIMIT 1" % quote_name(table_name)) return cursor.description def get_relations(cursor, table_name): diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py index 499a4cba84..74c19e22bf 100644 --- a/django/db/backends/sqlite3/introspection.py +++ b/django/db/backends/sqlite3/introspection.py @@ -1,9 +1,11 @@ +from django.db.backends.sqlite3.base import quote_name + def get_table_list(cursor): cursor.execute("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name") return [row[0] for row in cursor.fetchall()] def get_table_description(cursor, table_name): - cursor.execute("PRAGMA table_info(%s)" % table_name) + cursor.execute("PRAGMA table_info(%s)" % quote_name(table_name)) return [(row[1], row[2], None, None) for row in cursor.fetchall()] def get_relations(cursor, table_name):