Skip to content

Commit 62f11ac

Browse files
Clarify documentation on variables.
1 parent 4ec7685 commit 62f11ac

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

doc/src/variable.rst

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,18 @@ Variable Objects
2525

2626
.. method:: Variable.getvalue([pos=0])
2727

28-
Return the value at the given position in the variable.
28+
Return the value at the given position in the variable. For variables
29+
created using the method :func:`Cursor.arrayvar()` the value returned will
30+
be a list of each of the values in the PL/SQL index-by table. For variables
31+
bound to DML returning statements where the attribute
32+
`cx_Oracle.__future__.dml_ret_array_val` is set to the value True, the
33+
value returned will also be a list corresponding to the returned data for
34+
the given execution of the statement (as identified by the pos parameter).
35+
For variables bound to DML returning statements and the attribute
36+
`cx_Oracle.__future__.dml_ret_array_val` is not set or is set to the value
37+
False, the value returned depends on the number of rows returned by the
38+
first execution of the statement. If pos is a valid index into that array
39+
then the value at that index will be returned; otherwise, None is returned.
2940

3041

3142
.. attribute:: Variable.inconverter
@@ -73,6 +84,11 @@ Variable Objects
7384
.. attribute:: Variable.values
7485

7586
This read-only attribute returns a copy of the value of all actual
76-
positions in the variable as a list. The number of items in the list will
77-
correspond to the value of the :attr:`~Variable.actualElements` attribute.
87+
positions in the variable as a list. For variables bound to DML returning
88+
statements where the attribute `cx_Oracle.__future__.dml_ret_array_val` is
89+
not set or set to the value False, this will be the returned data for the
90+
first execution of the statement. In all other cases the elements returned
91+
will be the equivalent of calling :meth:`~Variable.getvalue()` for each
92+
valid position and the length will correspond to the value of the
93+
:attr:`~Variable.actualElements` attribute.
7894

0 commit comments

Comments
 (0)