Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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: http://code.djangoproject.com/svn/django/trunk@2645 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 0162a3b54fe5424b0daf60abdb870c4f00d977df 1 parent bb2a38c
Adrian Holovaty authored April 10, 2006

Showing 1 changed file with 1 addition and 2 deletions. Show diff stats Hide diff stats

  1. 3  django/core/db/backends/mysql.py
3  django/core/db/backends/mysql.py
@@ -110,8 +110,7 @@ def quote_name(self, name):
110 110
         return "`%s`" % name
111 111
 
112 112
 def get_last_insert_id(cursor, table_name, pk_name):
113  
-    cursor.execute("SELECT LAST_INSERT_ID()")
114  
-    return cursor.fetchone()[0]
  113
+    return cursor.lastrowid
115 114
 
116 115
 def get_date_extract_sql(lookup_type, table_name):
117 116
     # lookup_type is 'year', 'month', 'day'

0 notes on commit 0162a3b

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