Skip to content

Commit d9cf469

Browse files
Correct binding of LOB values.
1 parent 0d3aa46 commit d9cf469

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/cxoTransform.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@ int cxoTransform_fromPython(cxoTransformNum transformNum, PyObject *pyValue,
236236
case CXO_TRANSFORM_NCLOB:
237237
if (Py_TYPE(pyValue) == &cxoPyTypeLob) {
238238
lob = (cxoLob*) pyValue;
239-
dbValue->asLOB = lob->handle;
239+
if (var) {
240+
if (dpiVar_setFromLob(var->handle, arrayPos,
241+
lob->handle) < 0)
242+
return cxoError_raiseAndReturnInt();
243+
} else dbValue->asLOB = lob->handle;
240244
return 0;
241245
}
242246
if (transformNum == CXO_TRANSFORM_NCLOB)

test/LobVar.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ def __ValidateQuery(self, rows, lobType):
125125
string = prevChar * 5 + char * 5
126126
self.assertEqual(lob.read(offset, 10), string)
127127

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+
128137
def testBLOBCursorDescription(self):
129138
"test cursor description is accurate for BLOBs"
130139
self.cursor.execute("select * from TestBLOBs")

0 commit comments

Comments
 (0)