From 62f11ac57050b7aa3e3492b854271e03643eb567 Mon Sep 17 00:00:00 2001 From: Anthony Tuininga Date: Wed, 16 May 2018 14:09:33 -0600 Subject: [PATCH] Clarify documentation on variables. --- doc/src/variable.rst | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/doc/src/variable.rst b/doc/src/variable.rst index 16b8633..c519748 100644 --- a/doc/src/variable.rst +++ b/doc/src/variable.rst @@ -25,7 +25,18 @@ Variable Objects .. method:: Variable.getvalue([pos=0]) - Return the value at the given position in the variable. + Return the value at the given position in the variable. For variables + created using the method :func:`Cursor.arrayvar()` the value returned will + be a list of each of the values in the PL/SQL index-by table. For variables + bound to DML returning statements where the attribute + `cx_Oracle.__future__.dml_ret_array_val` is set to the value True, the + value returned will also be a list corresponding to the returned data for + the given execution of the statement (as identified by the pos parameter). + For variables bound to DML returning statements and the attribute + `cx_Oracle.__future__.dml_ret_array_val` is not set or is set to the value + False, the value returned depends on the number of rows returned by the + first execution of the statement. If pos is a valid index into that array + then the value at that index will be returned; otherwise, None is returned. .. attribute:: Variable.inconverter @@ -73,6 +84,11 @@ Variable Objects .. attribute:: Variable.values This read-only attribute returns a copy of the value of all actual - positions in the variable as a list. The number of items in the list will - correspond to the value of the :attr:`~Variable.actualElements` attribute. + positions in the variable as a list. For variables bound to DML returning + statements where the attribute `cx_Oracle.__future__.dml_ret_array_val` is + not set or set to the value False, this will be the returned data for the + first execution of the statement. In all other cases the elements returned + will be the equivalent of calling :meth:`~Variable.getvalue()` for each + valid position and the length will correspond to the value of the + :attr:`~Variable.actualElements` attribute.