Skip to content

Commit 33f4093

Browse files
Fixed bug when attempting to populate an array variable with too many
elements.
1 parent cd70b44 commit 33f4093

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Diff for: doc/src/release_notes.rst

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Thick Mode Changes
3131
database
3232
(`issue 114 <https://github.com/oracle/python-oracledb/issues/114>`__).
3333

34+
Common Changes
35+
++++++++++++++
36+
37+
#) Fixed bug when attempting to populate an array variable with too many
38+
elements.
39+
3440

3541
oracledb 1.2.1 (December 2022)
3642
------------------------------

Diff for: src/oracledb/impl/base/var.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ cdef class BaseVarImpl:
9999
if was_set != NULL:
100100
was_set[0] = False
101101
return 0
102-
errors._raise_err(errors.ERR_INCORRECT_VAR_ARRAY_SIZE,
102+
errors._raise_err(errors.ERR_INCORRECT_VAR_ARRAYSIZE,
103103
var_arraysize=self.num_elements,
104104
required_arraysize=num_elements_in_array)
105105

Diff for: tests/test_4300_cursor_other.py

+6
Original file line numberDiff line numberDiff line change
@@ -845,5 +845,11 @@ def test_4365_add_column_to_cached_query(self):
845845
self.cursor.execute(f"select * from {table_name}")
846846
self.assertEqual(self.cursor.fetchall(), [data])
847847

848+
def test_4366_populate_array_var_with_too_many_elements(self):
849+
"4366 - test population of array var with too many elements"
850+
var = self.cursor.arrayvar(int, 3)
851+
self.assertRaisesRegex(oracledb.ProgrammingError, "^DPY-2016:",
852+
var.setvalue, 0, [1, 2, 3, 4])
853+
848854
if __name__ == "__main__":
849855
test_env.run_test_cases()

0 commit comments

Comments
 (0)