Skip to content

Commit 659db44

Browse files
Internal change to slightly improve performance of LOB reads and writes.
1 parent de2792f commit 659db44

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

doc/src/release_notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Thin Mode Changes
2424
#) Fixed bug when fetch variables contain output converters and a query is
2525
re-executed
2626
(`issue 271 <https://github.com/oracle/python-oracledb/issues/271>`__).
27+
#) Internal change to slightly improve performance of LOB reads and writes.
2728

2829
Common Changes
2930
++++++++++++++

src/oracledb/impl/thin/constants.pxi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#------------------------------------------------------------------------------
2-
# Copyright (c) 2020, 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2020, 2024, 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
@@ -676,8 +676,8 @@ cdef enum:
676676
TNS_ENCODING_CONV_LENGTH = 0x02
677677

678678
# character set strings
679-
cdef str TNS_ENCODING_UTF8 = "UTF-8"
680-
cdef str TNS_ENCODING_UTF16 = "UTF-16BE"
679+
cdef const char* TNS_ENCODING_UTF8 = "UTF-8"
680+
cdef const char* TNS_ENCODING_UTF16 = "UTF-16BE"
681681

682682
# compile time capability indices
683683
cdef enum:

src/oracledb/impl/thin/lob.pyx

Lines changed: 3 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, 2024, 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
@@ -152,10 +152,10 @@ cdef class BaseThinLobImpl(BaseLobImpl):
152152
raise TypeError(
153153
"only strings can be written to CLOBs and NCLOBS"
154154
)
155-
message.data = value.encode(self._get_encoding())
155+
message.data = (<str> value).encode(self._get_encoding())
156156
return message
157157

158-
cdef str _get_encoding(self):
158+
cdef const char* _get_encoding(self):
159159
"""
160160
Return the encoding used by the LOB.
161161
"""

src/oracledb/impl/thin/messages.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2208,9 +2208,9 @@ cdef class LobOpMessage(Message):
22082208
cdef int _process_message(self, ReadBuffer buf,
22092209
uint8_t message_type) except -1:
22102210
cdef:
2211+
const char* encoding
22112212
const char_type *ptr
22122213
ssize_t num_bytes
2213-
str encoding
22142214
if message_type == TNS_MSG_TYPE_LOB_DATA:
22152215
buf.read_raw_bytes_and_length(&ptr, &num_bytes)
22162216
if self.source_lob_impl.dbtype._ora_type_num == TNS_DATA_TYPE_BLOB:

0 commit comments

Comments
 (0)