Skip to content

Commit 464ae4f

Browse files
Fixed bug that prevented the database error message from being returned
when connecting to a database that the listener configuration file states exists but actually doesn't (#51).
1 parent 948cf3b commit 464ae4f

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

doc/src/release_notes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ Thin Mode Changes
2626
#) Fixed bug when calling :func:`Cursor.parse()` multiple times with the same
2727
SQL statement.
2828
#) Fixed bug that prevented connecting to Oracle Database 12.1.0.1.
29+
#) Fixed bug that prevented the database error message from being returned
30+
when connecting to a database that the listener configuration file states
31+
exists but actually doesn't
32+
(`issue 51 <https://github.com/oracle/python-oracledb/issues/51>`__).
2933

3034
Thick Mode Changes
3135
++++++++++++++++++

src/oracledb/impl/thin/messages.pyx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,6 +2134,7 @@ cdef class ProtocolMessage(Message):
21342134
bytearray server_runtime_caps
21352135
Capabilities caps = buf._caps
21362136
const char_type *fdo
2137+
bytes temp_buf
21372138
ssize_t ix
21382139
uint8_t c
21392140
if message_type == TNS_MSG_TYPE_PROTOCOL:
@@ -2152,10 +2153,14 @@ cdef class ProtocolMessage(Message):
21522153
fdo = buf.read_raw_bytes(fdo_length)
21532154
ix = 6 + fdo[5] + fdo[6]
21542155
caps.ncharset_id = (fdo[ix + 3] << 8) + fdo[ix + 4]
2155-
server_compile_caps = bytearray(buf.read_bytes())
2156-
server_runtime_caps = bytearray(buf.read_bytes())
2157-
buf._caps._adjust_for_server_compile_caps(server_compile_caps)
2158-
buf._caps._adjust_for_server_runtime_caps(server_runtime_caps)
2156+
temp_buf = buf.read_bytes()
2157+
if temp_buf is not None:
2158+
server_compile_caps = bytearray(temp_buf)
2159+
buf._caps._adjust_for_server_compile_caps(server_compile_caps)
2160+
temp_buf = buf.read_bytes()
2161+
if temp_buf is not None:
2162+
server_runtime_caps = bytearray(temp_buf)
2163+
buf._caps._adjust_for_server_runtime_caps(server_runtime_caps)
21592164
else:
21602165
Message._process_message(self, buf, message_type)
21612166

0 commit comments

Comments
 (0)