Commits

Anonymous committed 3a5a88c

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

Comments (0)

Files changed (1)

django/core/db/backends/mysql.py

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