Skip to content

Commit 2baa27f

Browse files
Fixed bug in processing metadata that spans multiple packets when using
asyncio.
1 parent 18331d8 commit 2baa27f

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

doc/src/release_notes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Thin Mode Changes
3030
single line comment at the end of the statement.
3131
#) Fixed bug in determining the list of attributes for PL/SQL collections.
3232
#) Fixed bug in calculating the :data:`Connection.thin` attribute.
33+
#) Fixed bug in processing metadata that spans multiple packets when using
34+
:ref:`asyncio <asyncio>`.
3335

3436
Thick Mode Changes
3537
++++++++++++++++++

src/oracledb/impl/thin/messages.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ cdef class MessageWithData(Message):
459459
# if no fetch variables exist, nothing further to do at this point; the
460460
# processing that follows will take the metadata returned by the server
461461
# and use it to create new fetch variables
462-
if cursor_impl.fetch_var_impls is None:
462+
if statement._fetch_var_impls is None:
463463
return 0
464464

465465
# if the type handler set on the cursor or connection does not match
@@ -717,7 +717,7 @@ cdef class MessageWithData(Message):
717717
str message
718718
buf.skip_ub4() # max row size
719719
buf.read_ub4(&cursor_impl._num_columns)
720-
prev_fetch_var_impls = cursor_impl.fetch_var_impls
720+
prev_fetch_var_impls = stmt._fetch_var_impls
721721
cursor_impl._init_fetch_vars(cursor_impl._num_columns)
722722
if cursor_impl._num_columns > 0:
723723
buf.skip_ub1()

tests/test_5400_cursor_execute_async.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,15 @@ async def test_5434(self):
593593
await cursor.execute("select user from dual")
594594
self.assertEqual(await cursor.fetchone(), (expected_value,))
595595

596+
async def test_5435(self):
597+
"5435 - test metadata requiring multiple packets"
598+
values = [f"Test value 5435 - {i}" for i in range(1, 301)]
599+
columns = ", ".join(f"'{v}'" for v in values)
600+
query = f"select {columns} from dual"
601+
await self.cursor.execute(query)
602+
row = await self.cursor.fetchone()
603+
self.assertEqual(row, tuple(values))
604+
596605

597606
if __name__ == "__main__":
598607
test_env.run_test_cases()

0 commit comments

Comments
 (0)