Adjust formatting of PR #287.
This commit is contained in:
parent
a654befddf
commit
f324757909
@ -1326,12 +1326,8 @@ static PyObject *cxoCursor_callProc(cxoCursor *cursor, PyObject *args,
|
|||||||
keywordArguments) < 0)
|
keywordArguments) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// create the return value
|
// create the return value (only positional arguments are returned)
|
||||||
numArgs = 0;
|
numArgs = (listOfArguments) ? PySequence_Size(listOfArguments) : 0;
|
||||||
if (listOfArguments) {
|
|
||||||
//check already made in cxoCursor_call
|
|
||||||
numArgs = PySequence_Size(listOfArguments);
|
|
||||||
}
|
|
||||||
results = PyList_New(numArgs);
|
results = PyList_New(numArgs);
|
||||||
if (!results)
|
if (!results)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@ -87,12 +87,9 @@ class TestCase(TestEnv.BaseTestCase):
|
|||||||
self.assertEqual(results, ["hi", 10, 2.0])
|
self.assertEqual(results, ["hi", 10, 2.0])
|
||||||
|
|
||||||
def testCallProcAllKeywords(self):
|
def testCallProcAllKeywords(self):
|
||||||
"""test executing a stored procedure with arguments in keywordParameters"""
|
"test executing a stored procedure with args in keywordParameters"
|
||||||
kwargs = dict(
|
kwargs = dict(a_InOutValue=self.cursor.var(cx_Oracle.NUMBER),
|
||||||
a_InValue = "hi",
|
a_InValue="hi", a_OutValue=self.cursor.var(cx_Oracle.NUMBER))
|
||||||
a_InOutValue = self.cursor.var(cx_Oracle.NUMBER),
|
|
||||||
a_OutValue = self.cursor.var(cx_Oracle.NUMBER),
|
|
||||||
)
|
|
||||||
kwargs['a_InOutValue'].setvalue(0, 5)
|
kwargs['a_InOutValue'].setvalue(0, 5)
|
||||||
results = self.cursor.callproc("proc_Test", keywordParameters=kwargs)
|
results = self.cursor.callproc("proc_Test", keywordParameters=kwargs)
|
||||||
self.assertEqual(results, [])
|
self.assertEqual(results, [])
|
||||||
@ -100,22 +97,18 @@ class TestCase(TestEnv.BaseTestCase):
|
|||||||
self.assertEqual(kwargs['a_OutValue'].getvalue(), 2.0)
|
self.assertEqual(kwargs['a_OutValue'].getvalue(), 2.0)
|
||||||
|
|
||||||
def testCallProcOnlyLastKeyword(self):
|
def testCallProcOnlyLastKeyword(self):
|
||||||
"""test executing a stored procedure with last argument in keywordParameters"""
|
"test executing a stored procedure with last arg in keywordParameters"
|
||||||
kwargs = dict(
|
kwargs = dict(a_OutValue = self.cursor.var(cx_Oracle.NUMBER))
|
||||||
a_OutValue = self.cursor.var(cx_Oracle.NUMBER),
|
results = self.cursor.callproc("proc_Test", ("hi", 5), kwargs)
|
||||||
)
|
|
||||||
results = self.cursor.callproc("proc_Test", ("hi",5), kwargs)
|
|
||||||
self.assertEqual(results, ["hi", 10])
|
self.assertEqual(results, ["hi", 10])
|
||||||
self.assertEqual(kwargs['a_OutValue'].getvalue(), 2.0)
|
self.assertEqual(kwargs['a_OutValue'].getvalue(), 2.0)
|
||||||
|
|
||||||
def testCallProcRepeatedKeywordParameters(self):
|
def testCallProcRepeatedKeywordParameters(self):
|
||||||
"""test executing a stored procedure with repeated argument in keywordParameters"""
|
"test executing a stored procedure, repeated arg in keywordParameters"
|
||||||
kwargs = dict(
|
kwargs = dict(a_InValue="hi",
|
||||||
a_InValue = "hi",
|
a_OutValue=self.cursor.var(cx_Oracle.NUMBER))
|
||||||
a_OutValue = self.cursor.var(cx_Oracle.NUMBER),
|
|
||||||
)
|
|
||||||
self.assertRaises(cx_Oracle.DatabaseError, self.cursor.callproc,
|
self.assertRaises(cx_Oracle.DatabaseError, self.cursor.callproc,
|
||||||
"proc_Test", parameters=("hi",5), keywordParameters=kwargs)
|
"proc_Test", parameters=("hi", 5), keywordParameters=kwargs)
|
||||||
|
|
||||||
def testCallProcNoArgs(self):
|
def testCallProcNoArgs(self):
|
||||||
"""test executing a stored procedure without any arguments"""
|
"""test executing a stored procedure without any arguments"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user