Skip to content

Commit d56f257

Browse files
Improved BOOLEAN handling.
1 parent 8c8942a commit d56f257

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

doc/src/release_notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Thin Mode Changes
2222
collections.
2323
#) Removed internally set fixed size for database collections. Collections of
2424
any size supported by the database can now be created.
25+
#) Improved BOOLEAN handling.
2526
#) Fixed bug when calling :meth:`Cursor.executemany()` with PL/SQL when the
2627
size of the bound data increases on subsequent calls
2728
(`issue 132 <https://github.com/oracle/python-oracledb/issues/132>`__).

src/oracledb/impl/thin/constants.pxi

Lines changed: 5 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
@@ -568,7 +568,7 @@ DEF TNS_END_TO_END_DBOP = 0x0200
568568
DEF TNS_END_TO_END_MODULE = 0x0008
569569

570570
# versions
571-
DEF TNS_VERSION_DESIRED = 318
571+
DEF TNS_VERSION_DESIRED = 319
572572
DEF TNS_VERSION_MINIMUM = 300
573573
DEF TNS_VERSION_MIN_ACCEPTED = 315 # 12.1
574574
DEF TNS_VERSION_MIN_LARGE_SDU = 315
@@ -662,7 +662,9 @@ DEF TNS_CCAP_FIELD_VERSION_19_1_EXT_1 = 13
662662
DEF TNS_CCAP_FIELD_VERSION_20_1 = 14
663663
DEF TNS_CCAP_FIELD_VERSION_20_1_EXT_1 = 15
664664
DEF TNS_CCAP_FIELD_VERSION_21_1 = 16
665-
DEF TNS_CCAP_FIELD_VERSION_MAX = 16
665+
DEF TNS_CCAP_FIELD_VERSION_23_1 = 17
666+
DEF TNS_CCAP_FIELD_VERSION_23_1_EXT_1 = 18
667+
DEF TNS_CCAP_FIELD_VERSION_MAX = 18
666668
DEF TNS_CCAP_O5LOGON = 8
667669
DEF TNS_CCAP_O5LOGON_NP = 2
668670
DEF TNS_CCAP_O7LOGON = 32

src/oracledb/impl/thin/messages.pyx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,20 @@ cdef class Message:
267267
buf.write_uint8(self.message_type)
268268
buf.write_uint8(self.function_code)
269269
buf.write_seq_num()
270+
if buf._caps.ttc_field_version >= TNS_CCAP_FIELD_VERSION_23_1_EXT_1:
271+
buf.write_ub8(0) # token number
270272

271273
cdef int _write_message(self, WriteBuffer buf) except -1:
272274
self._write_function_code(buf)
273275

276+
cdef int _write_piggyback_code(self, WriteBuffer buf,
277+
uint8_t code) except -1:
278+
buf.write_uint8(TNS_MSG_TYPE_PIGGYBACK)
279+
buf.write_uint8(code)
280+
buf.write_seq_num()
281+
if buf._caps.ttc_field_version >= TNS_CCAP_FIELD_VERSION_23_1_EXT_1:
282+
buf.write_ub8(0) # token number
283+
274284
cdef int process(self, ReadBuffer buf) except -1:
275285
cdef uint8_t message_type
276286
self.flush_out_binds = False
@@ -1081,9 +1091,7 @@ cdef class MessageWithData(Message):
10811091
cdef:
10821092
unsigned int *cursor_ids
10831093
ssize_t i
1084-
buf.write_uint8(TNS_MSG_TYPE_PIGGYBACK)
1085-
buf.write_uint8(TNS_FUNC_CLOSE_CURSORS)
1086-
buf.write_seq_num()
1094+
self._write_piggyback_code(buf, TNS_FUNC_CLOSE_CURSORS)
10871095
buf.write_uint8(1) # pointer
10881096
buf.write_ub4(self.conn_impl._num_cursors_to_close)
10891097
cursor_ids = self.conn_impl._cursors_to_close.data.as_uints
@@ -1093,9 +1101,7 @@ cdef class MessageWithData(Message):
10931101

10941102
cdef int _write_current_schema_piggyback(self, WriteBuffer buf) except -1:
10951103
cdef bytes schema_bytes
1096-
buf.write_uint8(TNS_MSG_TYPE_PIGGYBACK)
1097-
buf.write_uint8(TNS_FUNC_SET_SCHEMA)
1098-
buf.write_seq_num()
1104+
self._write_piggyback_code(buf, TNS_FUNC_SET_SCHEMA)
10991105
buf.write_uint8(1) # pointer
11001106
schema_bytes = self.conn_impl._current_schema.encode()
11011107
buf.write_ub4(len(schema_bytes))
@@ -1106,10 +1112,8 @@ cdef class MessageWithData(Message):
11061112
cdef:
11071113
list lobs_to_close = self.conn_impl._temp_lobs_to_close
11081114
uint64_t total_size = 0
1109-
buf.write_uint8(TNS_MSG_TYPE_PIGGYBACK)
1110-
buf.write_uint8(TNS_FUNC_LOB_OP)
1115+
self._write_piggyback_code(buf, TNS_FUNC_LOB_OP)
11111116
op_code = TNS_LOB_OP_FREE_TEMP | TNS_LOB_OP_ARRAY
1112-
buf.write_seq_num()
11131117

11141118
# temp lob data
11151119
buf.write_uint8(1) # pointer
@@ -1162,9 +1166,7 @@ cdef class MessageWithData(Message):
11621166
flags |= TNS_END_TO_END_DBOP
11631167

11641168
# write initial packet data
1165-
buf.write_uint8(TNS_MSG_TYPE_PIGGYBACK)
1166-
buf.write_uint8(TNS_FUNC_SET_END_TO_END_ATTR)
1167-
buf.write_seq_num()
1169+
self._write_piggyback_code(buf, TNS_FUNC_SET_END_TO_END_ATTR)
11681170
buf.write_uint8(0) # pointer (cidnam)
11691171
buf.write_uint8(0) # pointer (cidser)
11701172
buf.write_ub4(flags)

0 commit comments

Comments
 (0)