Fixed #1590 -- Changed MySQL get_last_insert_id() implementation to use cursor.lastrowid instead of a separate SELECT statement. Thanks, Andy Dustman

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2645 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-04-10 00:32:42 +00:00
parent bb2a38cecc
commit 0162a3b54f
1 changed files with 1 additions and 2 deletions

View File

@ -110,8 +110,7 @@ class DatabaseWrapper(local):
return "`%s`" % name return "`%s`" % name
def get_last_insert_id(cursor, table_name, pk_name): def get_last_insert_id(cursor, table_name, pk_name):
cursor.execute("SELECT LAST_INSERT_ID()") return cursor.lastrowid
return cursor.fetchone()[0]
def get_date_extract_sql(lookup_type, table_name): def get_date_extract_sql(lookup_type, table_name):
# lookup_type is 'year', 'month', 'day' # lookup_type is 'year', 'month', 'day'