Skip to content

Commit 7a8498e

Browse files
Correct handling of objects when dynamic binding is performed.
1 parent c2c8d54 commit 7a8498e

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

.gitmodules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "odpi"]
22
path = odpi
33
url = https://github.com/oracle/odpi.git
4+
branch = v2.0.x

odpi

Submodule odpi updated 1 file

test/DMLReturning.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,19 @@ def testUpdateMultipleRows(self):
102102
"The final value of string 10"
103103
])
104104

105+
def testInsertAndReturnObject(self):
106+
"test inserting an object with DML returning"
107+
typeObj = self.connection.gettype("UDT_OBJECT")
108+
stringValue = "The string that will be verified"
109+
obj = typeObj.newobject()
110+
obj.STRINGVALUE = stringValue
111+
outVar = self.cursor.var(cx_Oracle.OBJECT, typename = "UDT_OBJECT")
112+
self.cursor.execute("""
113+
insert into TestObjects (IntCol, ObjectCol)
114+
values (4, :obj)
115+
returning ObjectCol into :outObj""",
116+
obj = obj, outObj = outVar)
117+
result = outVar.getvalue()
118+
self.assertEqual(result.STRINGVALUE, stringValue)
119+
self.connection.rollback()
120+

0 commit comments

Comments
 (0)