Skip to content

Commit a609df3

Browse files
Fixed a bug when calling cursor.executemany() with a PL/SQL statement
and a single row of data (#30).
1 parent c68c42a commit a609df3

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

doc/src/release_notes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Thin Mode Changes
1717
supported; an error is now raised only when the first attempt to use
1818
NCHAR, NVARCHAR2 or NCLOB data is made
1919
(`issue 16 <https://github.com/oracle/python-oracledb/issues/16>`__).
20+
#) Fixed a bug when calling `cursor.executemany()` with a PL/SQL statement and
21+
a single row of data
22+
(`issue 30 <https://github.com/oracle/python-oracledb/issues/30>`__).
2023
#) When using the connection parameter `https_proxy` while using protocol
2124
`tcp`, a more meaningful exception is now raised:
2225
`DPY-2029: https_proxy requires use of the tcps protocol`.

src/oracledb/impl/thin/cursor.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ cdef class ThinCursorImpl(BaseCursorImpl):
148148
for i in range(num_execs - 1):
149149
message.offset = i + 1
150150
self._conn_impl._protocol._process_single_message(message)
151-
else:
151+
elif num_execs > 1:
152152
message.offset = 1
153153
message.num_execs = num_execs - 1
154154
self._conn_impl._protocol._process_single_message(message)

tests/test_4000_cursor_executemany.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,5 +286,13 @@ def test_4019_re_executemany_pl_sql_with_in_and_out_binds(self):
286286
end;""", data)
287287
self.assertEqual(out_bind.values, [5, 8, 17, 24, 6])
288288

289+
def test_4020_executemany_with_plsql_single_row(self):
290+
"4020 - test PL/SQL statement with single row bind"
291+
value = 4020
292+
var = self.cursor.var(int)
293+
data = [[var, value]]
294+
self.cursor.executemany("begin :1 := :2; end;", data)
295+
self.assertEqual(var.values, [value])
296+
289297
if __name__ == "__main__":
290298
test_env.run_test_cases()

0 commit comments

Comments
 (0)