Skip to content

Commit e763419

Browse files
Ensure that decreasing number of rows returned from a DML returning statement
is detected properly.
1 parent 8fcea38 commit e763419

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/DMLReturning.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,20 @@ def testInsertAndReturnObject(self):
217217
cx_Oracle.__future__.dml_ret_array_val = False
218218
self.connection.rollback()
219219

220+
def testDeleteReturningDecreasingRowsReturned(self):
221+
"test delete returning multiple times with decreasing number of rows"
222+
data = [(i, "Test String %d" % i) for i in range(1, 11)]
223+
self.cursor.execute("truncate table TestTempTable")
224+
self.cursor.executemany("insert into TestTempTable values (:1, :2)",
225+
data)
226+
results = []
227+
intVar = self.cursor.var(int)
228+
self.cursor.setinputsizes(None, intVar)
229+
for intVal in (5, 8, 10):
230+
self.cursor.execute("""
231+
delete from TestTempTable
232+
where IntCol < :1
233+
returning IntCol into :2""", [intVal])
234+
results.append(intVar.values)
235+
self.assertEqual(results, [ [1, 2, 3, 4], [5, 6, 7], [8, 9] ])
236+

0 commit comments

Comments
 (0)