Ensure that behavior in cx_Oracle 6.3 with __future__.dml_ret_array_val not set
or False is the same as the behavior in cx_Oracle 6.2 (https://github.com/oracle/python-cx_Oracle/issues/176).
This commit is contained in:
parent
2ea4be0be9
commit
a79dcb2ff8
@ -443,11 +443,14 @@ PyObject *cxoVar_getSingleValue(cxoVar *var, dpiData *data, uint32_t arrayPos)
|
||||
if (dpiVar_getReturnedData(var->handle, 0, &numReturnedRows,
|
||||
&data) < 0)
|
||||
return cxoError_raiseAndReturnNull();
|
||||
if (arrayPos >= numReturnedRows) {
|
||||
if (arrayPos >= var->allocatedElements &&
|
||||
arrayPos >= numReturnedRows) {
|
||||
PyErr_SetString(PyExc_IndexError,
|
||||
"cxoVar_getSingleValue: array size exceeded");
|
||||
return NULL;
|
||||
}
|
||||
if (arrayPos >= numReturnedRows)
|
||||
data = var->data;
|
||||
}
|
||||
|
||||
// in all other cases, just get the value stored at specified position
|
||||
@ -497,7 +500,7 @@ PyObject *cxoVar_getValue(cxoVar *var, uint32_t arrayPos)
|
||||
return cxoError_raiseAndReturnNull();
|
||||
return cxoVar_getArrayValue(var, numElements, var->data);
|
||||
}
|
||||
if (arrayPos >= var->allocatedElements) {
|
||||
if (arrayPos >= var->allocatedElements && !var->getReturnedData) {
|
||||
PyErr_SetString(PyExc_IndexError,
|
||||
"cxoVar_getSingleValue: array size exceeded");
|
||||
return NULL;
|
||||
|
||||
@ -112,6 +112,8 @@ class TestDMLReturning(BaseTestCase):
|
||||
strVar = strVar)
|
||||
self.assertEqual(intVar.values, [])
|
||||
self.assertEqual(strVar.values, [])
|
||||
self.assertEqual(intVar.getvalue(), None)
|
||||
self.assertEqual(strVar.getvalue(), None)
|
||||
cx_Oracle.__future__.dml_ret_array_val = True
|
||||
try:
|
||||
self.assertEqual(intVar.values, [[]])
|
||||
@ -141,6 +143,8 @@ class TestDMLReturning(BaseTestCase):
|
||||
"The final value of string 9",
|
||||
"The final value of string 10"
|
||||
])
|
||||
self.assertEqual(intVar.getvalue(1), 24)
|
||||
self.assertEqual(strVar.getvalue(2), "The final value of string 10")
|
||||
cx_Oracle.__future__.dml_ret_array_val = True
|
||||
try:
|
||||
self.assertEqual(intVar.values, [[23, 24, 25]])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user