mirror of https://github.com/django/django.git
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:
parent
bb2a38cecc
commit
0162a3b54f
|
@ -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'
|
||||||
|
|
Loading…
Reference in New Issue