Fixed #2700 -- Improved introspection for MySQL. Thanks for the patch, serbaut@gmail.com

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3750 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-09-11 18:41:05 +00:00
parent eaaebf5752
commit ecf6a35112
2 changed files with 2 additions and 0 deletions

View File

@ -127,6 +127,7 @@ answer newbie questions, and generally made Django that much better:
Oliver Rutherfurd <http://rutherfurd.net/> Oliver Rutherfurd <http://rutherfurd.net/>
Ivan Sagalaev (Maniac) <http://www.softwaremaniacs.org/> Ivan Sagalaev (Maniac) <http://www.softwaremaniacs.org/>
David Schein David Schein
serbaut@gmail.com
Pete Shinners <pete@shinners.org> Pete Shinners <pete@shinners.org>
SmileyChris <smileychris@gmail.com> SmileyChris <smileychris@gmail.com>
sopel sopel

View File

@ -36,6 +36,7 @@ def get_relations(cursor, table_name):
SELECT column_name, referenced_table_name, referenced_column_name SELECT column_name, referenced_table_name, referenced_column_name
FROM information_schema.key_column_usage FROM information_schema.key_column_usage
WHERE table_name = %s WHERE table_name = %s
AND table_schema = DATABASE()
AND referenced_table_name IS NOT NULL AND referenced_table_name IS NOT NULL
AND referenced_column_name IS NOT NULL""", [table_name]) AND referenced_column_name IS NOT NULL""", [table_name])
constraints.extend(cursor.fetchall()) constraints.extend(cursor.fetchall())