mirror of
https://github.com/django/django.git
synced 2025-06-08 21:19:13 +00:00
magic-removal: Merged to [1688]
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1689 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
b5be4a4fcc
commit
b32aca5d8c
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user