[2.1.x] Fixed #29759 -- Fixed crash on Oracle when fetching a returned insert id with cx_Oracle 7.
Backport of da92ec7962
from master
This commit is contained in:
parent
4c5a8c6f50
commit
430966c2fc
|
@ -222,7 +222,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