File tree Expand file tree Collapse file tree 5 files changed +12
-12
lines changed Expand file tree Collapse file tree 5 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ Thin Mode Changes
1616#) Fixed bug when calling :meth: `~Connection.gettype() ` with an object type
1717 name containing ``%ROWTYPE ``
1818 (`issue 304 <https://github.com/oracle/python-oracledb/issues/304 >`__).
19+ #) Tightened up code looking for the end of a database request.
1920#) Restored error message raised when attempting to connect to Oracle Database
2021 11g.
2122
Original file line number Diff line number Diff line change @@ -79,15 +79,6 @@ cdef class Capabilities:
7979 errors._raise_err(errors.ERR_NCHAR_CS_NOT_SUPPORTED,
8080 charset_id = self .ncharset_id)
8181
82- cdef void _check_supports_end_of_request(self ):
83- """
84- Checks whether the end of request flag is sent and sets a boolean to
85- avoid calculating it each time.
86- """
87- if self .ttc_field_version >= TNS_CCAP_FIELD_VERSION_19_1 \
88- and self .compile_caps[TNS_CCAP_TTC4] & TNS_CCAP_END_OF_REQUEST:
89- self .supports_end_of_request = True
90-
9182 @ cython.boundscheck (False )
9283 cdef void _init_compile_caps(self ):
9384 self .ttc_field_version = TNS_CCAP_FIELD_VERSION_MAX
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ cdef enum:
4747
4848# data flags
4949cdef enum :
50+ TNS_DATA_FLAGS_END_OF_REQUEST = 0x2000
5051 TNS_DATA_FLAGS_EOF = 0x0040
5152
5253# marker types
@@ -740,6 +741,7 @@ cdef enum:
740741# accept flags
741742cdef enum :
742743 TNS_ACCEPT_FLAG_FAST_AUTH = 0x10000000
744+ TNS_ACCEPT_FLAG_HAS_END_OF_REQUEST = 0x02000000
743745
744746# other constants
745747cdef enum :
Original file line number Diff line number Diff line change @@ -1847,6 +1847,8 @@ cdef class ConnectMessage(Message):
18471847 buf.read_uint32(& flags)
18481848 if flags & TNS_ACCEPT_FLAG_FAST_AUTH:
18491849 buf._caps.supports_fast_auth = True
1850+ if flags & TNS_ACCEPT_FLAG_HAS_END_OF_REQUEST:
1851+ buf._caps.supports_end_of_request = True
18501852 buf._caps._adjust_for_protocol(protocol_version, protocol_options)
18511853 buf._transport._full_packet_size = True
18521854 elif buf._current_packet.packet_type == TNS_PACKET_TYPE_REFUSE:
@@ -1923,7 +1925,6 @@ cdef class DataTypesMessage(Message):
19231925 buf.read_uint16(& conv_data_type)
19241926 if conv_data_type != 0 :
19251927 buf.skip_raw_bytes(4 )
1926- buf._caps._check_supports_end_of_request()
19271928
19281929 cdef int _write_message(self , WriteBuffer buf) except - 1 :
19291930 cdef:
Original file line number Diff line number Diff line change @@ -60,8 +60,13 @@ cdef class Packet:
6060 Returns a boolean indicating if the end of request byte is found at the
6161 end of the packet.
6262 """
63- cdef char * ptr = cpython.PyBytes_AS_STRING(self .buf)
64- return ptr[self .packet_size - 1 ] == TNS_MSG_TYPE_END_OF_REQUEST
63+ cdef:
64+ uint16_t flags
65+ char * ptr
66+ ptr = cpython.PyBytes_AS_STRING(self .buf)
67+ flags = unpack_uint16(< const char_type* > & ptr[PACKET_HEADER_SIZE],
68+ BYTE_ORDER_MSB)
69+ return flags & TNS_DATA_FLAGS_END_OF_REQUEST
6570
6671
6772@cython.final
You can’t perform that action at this time.
0 commit comments