Added additional test to verify case when a DML returning statement returns
multiple rows during one execute but in the subsequent execute it returns no rows.
This commit is contained in:
parent
721f32eb43
commit
355d7f34aa
|
@ -158,10 +158,11 @@ class TestDMLReturning(BaseTestCase):
|
||||||
|
|
||||||
def testUpdateMultipleRowsExecuteMany(self):
|
def testUpdateMultipleRowsExecuteMany(self):
|
||||||
"test update multiple rows with DML returning (executeMany)"
|
"test update multiple rows with DML returning (executeMany)"
|
||||||
|
data = [(i, "The initial value of string %d" % i) \
|
||||||
|
for i in range(1, 11)]
|
||||||
self.cursor.execute("truncate table TestTempTable")
|
self.cursor.execute("truncate table TestTempTable")
|
||||||
for i in range(1, 11):
|
self.cursor.executemany("insert into TestTempTable values (:1, :2)",
|
||||||
self.cursor.execute("insert into TestTempTable values (:1, :2)",
|
data)
|
||||||
(i, "The initial value of string %d" % i))
|
|
||||||
intVar = self.cursor.var(cx_Oracle.NUMBER, arraysize = 3)
|
intVar = self.cursor.var(cx_Oracle.NUMBER, arraysize = 3)
|
||||||
strVar = self.cursor.var(str, arraysize = 3)
|
strVar = self.cursor.var(str, arraysize = 3)
|
||||||
self.cursor.setinputsizes(None, intVar, strVar)
|
self.cursor.setinputsizes(None, intVar, strVar)
|
||||||
|
@ -238,3 +239,18 @@ class TestDMLReturning(BaseTestCase):
|
||||||
results.append(intVar.values)
|
results.append(intVar.values)
|
||||||
self.assertEqual(results, [ [1, 2, 3, 4], [5, 6, 7], [8, 9] ])
|
self.assertEqual(results, [ [1, 2, 3, 4], [5, 6, 7], [8, 9] ])
|
||||||
|
|
||||||
|
def testDeleteReturningNoRowsAfterManyRows(self):
|
||||||
|
"test delete returning no rows after initially returning many rows"
|
||||||
|
data = [(i, "Test String %d" % i) for i in range(1, 11)]
|
||||||
|
self.cursor.execute("truncate table TestTempTable")
|
||||||
|
self.cursor.executemany("insert into TestTempTable values (:1, :2)",
|
||||||
|
data)
|
||||||
|
intVar = self.cursor.var(int)
|
||||||
|
self.cursor.execute("""
|
||||||
|
delete from TestTempTable
|
||||||
|
where IntCol < :1
|
||||||
|
returning IntCol into :2""", [5, intVar])
|
||||||
|
self.assertEqual(intVar.values, [1, 2, 3, 4])
|
||||||
|
self.cursor.execute(None, [4, intVar])
|
||||||
|
self.assertEqual(intVar.values, [])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue