Added better docstring to get_indexes() for MySQL backend

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2347 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-02-18 21:28:19 +00:00
parent ac97cf54af
commit 27b41fd9de
1 changed files with 6 additions and 1 deletions

View File

@ -136,7 +136,12 @@ def get_relations(cursor, table_name):
raise NotImplementedError raise NotImplementedError
def get_indexes(cursor, table_name): def get_indexes(cursor, table_name):
"Returns a dict of indexes for given table" """
Returns a dictionary of fieldname -> infodict for the given table,
where each infodict is in the format:
{'keyname': 'name of key',
'unique': boolean representing whether it's a unique index}
"""
cursor.execute("SHOW INDEX FROM %s" % DatabaseWrapper().quote_name(table_name)) cursor.execute("SHOW INDEX FROM %s" % DatabaseWrapper().quote_name(table_name))
indexes = {} indexes = {}
for row in cursor.fetchall(): for row in cursor.fetchall():