diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-04-10 00:32:42 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-04-10 00:32:42 +0000 |
| commit | 0162a3b54fe5424b0daf60abdb870c4f00d977df (patch) | |
| tree | 385c718d00ab8b1faa1a7aec8eb85137fa95986e | |
| parent | bb2a38ceccaaf0f2259ebbba6372a483459d77ac (diff) | |
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
| -rw-r--r-- | django/core/db/backends/mysql.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/django/core/db/backends/mysql.py b/django/core/db/backends/mysql.py index 1b67fc8615..d0e27e6f44 100644 --- a/django/core/db/backends/mysql.py +++ b/django/core/db/backends/mysql.py @@ -110,8 +110,7 @@ class DatabaseWrapper(local): 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' |
