summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-12-16 05:13:25 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-12-16 05:13:25 +0000
commit676830165ad168de513bf19e12027e0f71b02a3c (patch)
tree9e9bb3e3f3c82ca6129942e9d2a443598c98f9fe
parent551897b13446426a2533dafdbd2ea2bc4f96b1e5 (diff)
Fixed #646 -- inspectdb no longer fails on database tables with hyphen in the name. Thanks for reporting, jack at xiph.org
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1688 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/core/db/backends/mysql.py2
-rw-r--r--django/core/db/backends/postgresql.py2
-rw-r--r--django/core/db/backends/sqlite3.py2
3 files changed, 3 insertions, 3 deletions
diff --git a/django/core/db/backends/mysql.py b/django/core/db/backends/mysql.py
index 0e31af13fc..643b51fcd4 100644
--- a/django/core/db/backends/mysql.py
+++ b/django/core/db/backends/mysql.py
@@ -126,7 +126,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" % DatabaseWrapper.quote_name(table_name))
return cursor.description
def get_relations(cursor, table_name):
diff --git a/django/core/db/backends/postgresql.py b/django/core/db/backends/postgresql.py
index a4ce5b39ee..c2eb072cdb 100644
--- a/django/core/db/backends/postgresql.py
+++ b/django/core/db/backends/postgresql.py
@@ -102,7 +102,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" % DatabaseWrapper().quote_name(table_name))
return cursor.description
def get_relations(cursor, table_name):
diff --git a/django/core/db/backends/sqlite3.py b/django/core/db/backends/sqlite3.py
index 1a4a80d632..3d466a60c6 100644
--- a/django/core/db/backends/sqlite3.py
+++ b/django/core/db/backends/sqlite3.py
@@ -128,7 +128,7 @@ def get_table_list(cursor):
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)" % DatabaseWrapper.quote_name(table_name))
return [(row[1], row[2], None, None) for row in cursor.fetchall()]
def get_relations(cursor, table_name):