mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
Fixed #29759 -- Fixed crash on Oracle when fetching a returned insert id with cx_Oracle 7.
This commit is contained in:
parent
f87f9c5f63
commit
da92ec7962
@ -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(
|
||||
|
@ -17,3 +17,5 @@ Bugfixes
|
||||
|
||||
* Made migrations detect changes to ``Meta.default_related_name``
|
||||
(:ticket:`29755`).
|
||||
|
||||
* Added compatibility for ``cx_Oracle`` 7 (:ticket:`29759`).
|
||||
|
Loading…
Reference in New Issue
Block a user