mirror of
https://github.com/django/django.git
synced 2025-03-31 03:30:46 +00:00
Fixed backends.oracle.tests.TransactionalTests.test_hidden_no_data_found_exception() on oracledb >= 2.1.2.
python-oracledb 2.1.2+ no longer hides 'ORA-1403: no data found' exceptions raised in database triggers: https://github.com/oracle/python-oracledb/issues/321
This commit is contained in:
parent
42bc81b1b6
commit
dd23821208
@ -19,6 +19,7 @@ from django.db.backends.utils import debug_transaction
|
|||||||
from django.utils.asyncio import async_unsafe
|
from django.utils.asyncio import async_unsafe
|
||||||
from django.utils.encoding import force_bytes, force_str
|
from django.utils.encoding import force_bytes, force_str
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
|
from django.utils.version import get_version_tuple
|
||||||
|
|
||||||
|
|
||||||
def _setup_environment(environ):
|
def _setup_environment(environ):
|
||||||
@ -345,6 +346,10 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
|||||||
with self.temporary_connection():
|
with self.temporary_connection():
|
||||||
return tuple(int(x) for x in self.connection.version.split("."))
|
return tuple(int(x) for x in self.connection.version.split("."))
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def oracledb_version(self):
|
||||||
|
return get_version_tuple(Database.__version__)
|
||||||
|
|
||||||
|
|
||||||
class OracleParam:
|
class OracleParam:
|
||||||
"""
|
"""
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from django.db import DatabaseError, InterfaceError
|
from django.db import DatabaseError, InterfaceError
|
||||||
from django.db.backends.base.features import BaseDatabaseFeatures
|
from django.db.backends.base.features import BaseDatabaseFeatures
|
||||||
|
from django.db.backends.oracle.oracledb_any import is_oracledb
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
|
|
||||||
|
|
||||||
@ -137,6 +138,16 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
if is_oracledb and self.connection.oracledb_version >= (2, 1, 2):
|
||||||
|
skips.update(
|
||||||
|
{
|
||||||
|
"python-oracledb 2.1.2+ no longer hides 'ORA-1403: no data found' "
|
||||||
|
"exceptions raised in database triggers.": {
|
||||||
|
"backends.oracle.tests.TransactionalTests."
|
||||||
|
"test_hidden_no_data_found_exception"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
return skips
|
return skips
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
|
@ -295,6 +295,8 @@ END;
|
|||||||
columns = []
|
columns = []
|
||||||
for param in returning_params:
|
for param in returning_params:
|
||||||
value = param.get_value()
|
value = param.get_value()
|
||||||
|
# Can be removed when cx_Oracle is no longer supported and
|
||||||
|
# python-oracle 2.1.2 becomes the minimum supported version.
|
||||||
if value == []:
|
if value == []:
|
||||||
raise DatabaseError(
|
raise DatabaseError(
|
||||||
"The database did not return a new row id. Probably "
|
"The database did not return a new row id. Probably "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user