@@ -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