Please note - there is a similar bug which was raised before - but I dont think it's the same.
When selecting from a VARCHAR that contains binrary data the data is truncated on the first null.
Extract of fix in _db2_module.c below:
<code>
static PyObject *
_SQL_CType_2_PyType(DB2BindStruct *bs, int idx)
{
PyObject *val, *tmpVal;
char *tempStr;
int size;
SQLPOINTER buf = (SQLPOINTER)((SQLCHAR *)bs->buf + (bs->bufLen * idx));
DATE_STRUCT dateSt;
TIME_STRUCT timeSt;
TIMESTAMP_STRUCT timestampSt;
char *fractionPart;
if ( bs->outLen[idx] == SQL_NULL_DATA ) {
Py_INCREF(Py_None);
return Py_None;
}
switch (bs->type) {
case SQL_C_CHAR:
switch (bs->typeEx) {
case SQL_BIGINT:
val = PyLong_FromString((SQLCHAR *)(buf), NULL, 0);
break;
case SQL_DECIMAL: /* WARNING! */
case SQL_NUMERIC: /* WARNING! */
tmpVal = PyString_FromString((SQLCHAR *)(buf));
val = PyFloat_FromString(tmpVal, NULL);
Py_DECREF(tmpVal);
break;
default:
//buf may contain null characters
//val = PyString_FromString((SQLCHAR *)(buf));
val = PyString_FromStringAndSize((SQLCHAR *)(buf), *bs->outLen);
break;
}
break;
..
...
...
</cvde>