diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2018-09-16 12:45:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-16 12:45:34 +0200 |
| commit | da92ec79621fc0bba671d8afa52b7f6884962fe5 (patch) | |
| tree | 5e45677246c21d2f955d31d80998a0edca528214 /django | |
| parent | f87f9c5f63f779edc74f286ccf88d13db96c44de (diff) | |
Fixed #29759 -- Fixed crash on Oracle when fetching a returned insert id with cx_Oracle 7.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/oracle/operations.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py index 02c7cdcc63..9cfee5897d 100644 --- a/django/db/backends/oracle/operations.py +++ b/django/db/backends/oracle/operations.py @@ -226,7 +226,9 @@ END; def fetch_returned_insert_id(self, cursor): try: - return int(cursor._insert_id_var.getvalue()) + value = cursor._insert_id_var.getvalue() + # cx_Oracle < 7 returns value, >= 7 returns list with single value. + return int(value[0] if isinstance(value, list) else value) except (IndexError, TypeError): # cx_Oracle < 6.3 returns None, >= 6.3 raises IndexError. raise DatabaseError( |
