Skip to content
Browse files

Fixed #1590 -- Changed MySQL get_last_insert_id() implementation to u…

…se cursor.lastrowid instead of a separate SELECT statement. Thanks, Andy Dustman

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent bb2a38c commit 0162a3b54fe5424b0daf60abdb870c4f00d977df @adrianholovaty adrianholovaty committed
Showing with 1 addition and 2 deletions.
  1. +1 −2 django/core/db/backends/
3 django/core/db/backends/
@@ -110,8 +110,7 @@ def quote_name(self, name):
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'

0 comments on commit 0162a3b

Please sign in to comment.
Something went wrong with that request. Please try again.