Patch 4/4: Fix TEXT vs. BLOB conversion.

This patch assumes an applied patch 3 (https://sourceforge.net/p/mysql-python/patches/79/). Looks a bit like a hack, but the infrastructure doesn't seem to allow anything else. And it works here very well. I'm not sure, how it works with very old mysql versions (<= 4.0).

https://sourceforge.net/p/mysql-python/patches/80/
This commit is contained in:
André Malo
2012-10-03 13:20:19 -04:00
committed by farcepest
parent c05a2c6a50
commit cd44524fef

View File

@ -471,13 +471,17 @@ _mysql_ResultObject_Initialize(
return -1; return -1;
} }
if (PyTuple_Check(t) && PyTuple_GET_SIZE(t) == 2) { if (PyTuple_Check(t) && PyTuple_GET_SIZE(t) == 2) {
long mask; long mask, flags;
PyObject *pmask=NULL; PyObject *pmask=NULL;
pmask = PyTuple_GET_ITEM(t, 0); pmask = PyTuple_GET_ITEM(t, 0);
fun2 = PyTuple_GET_ITEM(t, 1); fun2 = PyTuple_GET_ITEM(t, 1);
if (PyInt_Check(pmask)) { if (PyInt_Check(pmask)) {
mask = PyInt_AS_LONG(pmask); mask = PyInt_AS_LONG(pmask);
if (mask & fields[i].flags) { flags = fields[i].flags;
if (fields[i].charsetnr != 63) { /* maaagic */
flags &= ~BINARY_FLAG;
}
if (mask & flags) {
Py_DECREF(t); Py_DECREF(t);
break; break;
} }