Skip to content

Commit 0374b18

Browse files
Defer raising an exception when calling Connection.gettype() for a type
containing an attribute or element with an unsupported data type until the first attempt to reference the attribute or element with the unsupported data type.
1 parent 3a18494 commit 0374b18

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

doc/src/api_manual/module.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,6 +2277,12 @@ when binding data.
22772277
:data:`DATETIME`.
22782278

22792279

2280+
.. data:: DB_TYPE_UNSUPPORTED
2281+
2282+
Describes columns, attributes or array elements in a database that are
2283+
unknown and unsupported.
2284+
2285+
22802286
.. data:: DB_TYPE_UROWID
22812287

22822288
Describes columns, attributes or array elements in a database that are of

doc/src/release_notes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Thick Mode Changes
3535
detected.
3636
#) Added support for the "signed int", "signed long" and "decimal128" scalar
3737
types in JSON (generally only seen when converting from MongoDB).
38+
#) Defer raising an exception when calling :meth:`Connection.gettype()`
39+
for a type containing an attribute or element with an unsupported data type
40+
until the first attempt to reference the attribute or element with the
41+
unsupported data type.
3842

3943
Common Changes
4044
++++++++++++++

src/oracledb/base_impl.pxd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ cdef enum:
6767
DB_TYPE_NUM_TIMESTAMP = 2012
6868
DB_TYPE_NUM_TIMESTAMP_LTZ = 2014
6969
DB_TYPE_NUM_TIMESTAMP_TZ = 2013
70+
DB_TYPE_NUM_UNSUPPORTED = 0
7071
DB_TYPE_NUM_UROWID = 2030
7172
DB_TYPE_NUM_VARCHAR = 2001
7273

src/oracledb/impl/base/types.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ cdef dict db_type_by_ora_type_num = {}
5656

5757
cdef class DbType:
5858

59-
def __init__(self, num, name, ora_name, ora_type_num, default_size=0,
59+
def __init__(self, num, name, ora_name, ora_type_num=0, default_size=0,
6060
csfrm=0, buffer_size_factor=0):
6161
cdef uint16_t ora_type_key = csfrm * 256 + ora_type_num
6262
self.num = num
@@ -160,6 +160,8 @@ DB_TYPE_TIMESTAMP_LTZ = DbType(DB_TYPE_NUM_TIMESTAMP_LTZ,
160160
DB_TYPE_TIMESTAMP_TZ = DbType(DB_TYPE_NUM_TIMESTAMP_TZ, "DB_TYPE_TIMESTAMP_TZ",
161161
"TIMESTAMP WITH TZ", 181,
162162
buffer_size_factor=13)
163+
DB_TYPE_UNSUPPORTED = DbType(DB_TYPE_NUM_UNSUPPORTED, "DB_TYPE_UNSUPPORTED",
164+
"UNSUPPORTED")
163165
DB_TYPE_UROWID = DbType(DB_TYPE_NUM_UROWID, "DB_TYPE_UROWID", "UROWID", 208)
164166
DB_TYPE_VARCHAR = DbType(DB_TYPE_NUM_VARCHAR, "DB_TYPE_VARCHAR", "VARCHAR2",
165167
1, 4000, csfrm=1, buffer_size_factor=4)

0 commit comments

Comments
 (0)