Refs #28859 -- Fixed "no data found" exception handling with cx_Oracle 6.3+.

This commit is contained in:
Mariusz Felisiak 2018-04-28 19:39:45 +02:00 committed by GitHub
parent 30f8642f2e
commit 483cc1c430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -223,7 +223,8 @@ END;
def fetch_returned_insert_id(self, cursor): def fetch_returned_insert_id(self, cursor):
try: try:
return int(cursor._insert_id_var.getvalue()) return int(cursor._insert_id_var.getvalue())
except TypeError: except (IndexError, TypeError):
# cx_Oracle < 6.3 returns None, >= 6.3 raises IndexError.
raise DatabaseError( raise DatabaseError(
'The database did not return a new row id. Probably "ORA-1403: ' 'The database did not return a new row id. Probably "ORA-1403: '
'no data found" was raised internally but was hidden by the ' 'no data found" was raised internally but was hidden by the '