Correct binding of LOB values.

This commit is contained in:
Anthony Tuininga 2018-02-16 16:20:50 -07:00
parent 0d3aa46d02
commit d9cf469167
2 changed files with 14 additions and 1 deletions

View File

@ -236,7 +236,11 @@ int cxoTransform_fromPython(cxoTransformNum transformNum, PyObject *pyValue,
case CXO_TRANSFORM_NCLOB:
if (Py_TYPE(pyValue) == &cxoPyTypeLob) {
lob = (cxoLob*) pyValue;
dbValue->asLOB = lob->handle;
if (var) {
if (dpiVar_setFromLob(var->handle, arrayPos,
lob->handle) < 0)
return cxoError_raiseAndReturnInt();
} else dbValue->asLOB = lob->handle;
return 0;
}
if (transformNum == CXO_TRANSFORM_NCLOB)

View File

@ -125,6 +125,15 @@ class TestLobVar(BaseTestCase):
string = prevChar * 5 + char * 5
self.assertEqual(lob.read(offset, 10), string)
def testBindLobValue(self):
"test binding a LOB value directly"
self.cursor.execute("truncate table TestCLOBs")
self.cursor.execute("insert into TestCLOBs values (1, 'Short value')")
self.cursor.execute("select ClobCol from TestCLOBs")
lob, = self.cursor.fetchone()
self.cursor.execute("insert into TestCLOBs values (2, :value)",
value = lob)
def testBLOBCursorDescription(self):
"test cursor description is accurate for BLOBs"
self.cursor.execute("select * from TestBLOBs")