Skip to content

Commit f8dce4f

Browse files
Minor tweak to previous change plus addition of test cases.
1 parent 0374b18 commit f8dce4f

File tree

5 files changed

+29
-6
lines changed

5 files changed

+29
-6
lines changed

doc/src/api_manual/module.rst

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

22792279

2280-
.. data:: DB_TYPE_UNSUPPORTED
2280+
.. data:: DB_TYPE_UNKNOWN
22812281

22822282
Describes columns, attributes or array elements in a database that are
2283-
unknown and unsupported.
2283+
of an unknown type.
22842284

22852285

22862286
.. data:: DB_TYPE_UROWID

src/oracledb/base_impl.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +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
70+
DB_TYPE_NUM_UNKNOWN = 0
7171
DB_TYPE_NUM_UROWID = 2030
7272
DB_TYPE_NUM_VARCHAR = 2001
7373

src/oracledb/impl/base/types.pyx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#------------------------------------------------------------------------------
2-
# Copyright (c) 2020, 2022, Oracle and/or its affiliates.
2+
# Copyright (c) 2020, 2023, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -160,8 +160,7 @@ 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")
163+
DB_TYPE_UNKNOWN = DbType(DB_TYPE_NUM_UNKNOWN, "DB_TYPE_UNKNOWN", "UNKNOWN")
165164
DB_TYPE_UROWID = DbType(DB_TYPE_NUM_UROWID, "DB_TYPE_UROWID", "UROWID", 208)
166165
DB_TYPE_VARCHAR = DbType(DB_TYPE_NUM_VARCHAR, "DB_TYPE_VARCHAR", "VARCHAR2",
167166
1, 4000, csfrm=1, buffer_size_factor=4)

tests/sql/create_schema.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ create or replace type &main_user..udt_Book as object (
132132
);
133133
/
134134

135+
create or replace type &main_user..udt_UnknownAttributeType as object (
136+
NumberValue number(9),
137+
XMLValue sys.xmltype
138+
);
139+
/
140+
141+
create or replace type &main_user..udt_UnknownElementType
142+
as table of sys.xmltype;
143+
/
144+
135145
-- create tables
136146
create table &main_user..TestNumbers (
137147
IntCol number(9) not null,

tests/test_2300_object_var.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,5 +594,19 @@ def test_2327_large_collection(self):
594594
(2327, obj))
595595
self.assertEqual(result, 7146445847327)
596596

597+
@unittest.skipIf(test_env.get_is_thin(),
598+
"thin mode doesn't have any unknown types currently")
599+
def test_2328_unknown_type_attribute(self):
600+
"2328 - test object with unknown type in one of its attributes"
601+
typ = self.connection.gettype("UDT_UNKNOWNATTRIBUTETYPE")
602+
self.assertEqual(typ.attributes[1].type, oracledb.DB_TYPE_UNKNOWN)
603+
604+
@unittest.skipIf(test_env.get_is_thin(),
605+
"thin mode doesn't have any unknown types currently")
606+
def test_2329_unknown_type_element(self):
607+
"2329 - test object with unknown type as the element type"
608+
typ = self.connection.gettype("UDT_UNKNOWNELEMENTTYPE")
609+
self.assertEqual(typ.element_type, oracledb.DB_TYPE_UNKNOWN)
610+
597611
if __name__ == "__main__":
598612
test_env.run_test_cases()

0 commit comments

Comments
 (0)