1
0
mirror of https://github.com/django/django.git synced 2025-03-13 10:50:55 +00:00

Fixed #35054 -- Fixed crash on Oracle when fetching JSONFields with oracledb 2.0.0.

This commit is contained in:
Mariusz Felisiak 2023-12-22 09:43:45 +01:00 committed by GitHub
parent 2bf46c3825
commit 6c08dba517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -453,7 +453,7 @@ class FormatStylePlaceholderCursor:
def _output_type_handler(cursor, name, defaultType, length, precision, scale): def _output_type_handler(cursor, name, defaultType, length, precision, scale):
""" """
Called for each db column fetched from cursors. Return numbers as the Called for each db column fetched from cursors. Return numbers as the
appropriate Python type. appropriate Python type, and NCLOB with JSON as strings.
""" """
if defaultType == Database.NUMBER: if defaultType == Database.NUMBER:
if scale == -127: if scale == -127:
@ -483,6 +483,10 @@ class FormatStylePlaceholderCursor:
arraysize=cursor.arraysize, arraysize=cursor.arraysize,
outconverter=outconverter, outconverter=outconverter,
) )
# oracledb 2.0.0+ returns NLOB columns with IS JSON constraints as
# dicts. Use a no-op converter to avoid this.
elif defaultType == Database.DB_TYPE_NCLOB:
return cursor.var(Database.DB_TYPE_NCLOB, arraysize=cursor.arraysize)
def _format_params(self, params): def _format_params(self, params):
try: try:

View File

@ -27,3 +27,5 @@ Bugfixes
* Fixed a regression in Django 5.0 where admin fields on the same line could * Fixed a regression in Django 5.0 where admin fields on the same line could
overflow the page and become non-interactive (:ticket:`35012`). overflow the page and become non-interactive (:ticket:`35012`).
* Added compatibility for ``oracledb`` 2.0.0 (:ticket:`35054`).