1 parent 0d3aa46 commit d9cf469Copy full SHA for d9cf469
2 files changed
src/cxoTransform.c
@@ -236,7 +236,11 @@ int cxoTransform_fromPython(cxoTransformNum transformNum, PyObject *pyValue,
236
case CXO_TRANSFORM_NCLOB:
237
if (Py_TYPE(pyValue) == &cxoPyTypeLob) {
238
lob = (cxoLob*) pyValue;
239
- dbValue->asLOB = lob->handle;
+ if (var) {
240
+ if (dpiVar_setFromLob(var->handle, arrayPos,
241
+ lob->handle) < 0)
242
+ return cxoError_raiseAndReturnInt();
243
+ } else dbValue->asLOB = lob->handle;
244
return 0;
245
}
246
if (transformNum == CXO_TRANSFORM_NCLOB)
test/LobVar.py
@@ -125,6 +125,15 @@ def __ValidateQuery(self, rows, lobType):
125
string = prevChar * 5 + char * 5
126
self.assertEqual(lob.read(offset, 10), string)
127
128
+ def testBindLobValue(self):
129
+ "test binding a LOB value directly"
130
+ self.cursor.execute("truncate table TestCLOBs")
131
+ self.cursor.execute("insert into TestCLOBs values (1, 'Short value')")
132
+ self.cursor.execute("select ClobCol from TestCLOBs")
133
+ lob, = self.cursor.fetchone()
134
+ self.cursor.execute("insert into TestCLOBs values (2, :value)",
135
+ value = lob)
136
+
137
def testBLOBCursorDescription(self):
138
"test cursor description is accurate for BLOBs"
139
self.cursor.execute("select * from TestBLOBs")
0 commit comments