From cd44524fef63bd3fcb71947392326e9742d520e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Malo?= Date: Wed, 3 Oct 2012 13:20:19 -0400 Subject: 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/ --- MySQLdb/_mysql.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'MySQLdb') diff --git a/MySQLdb/_mysql.c b/MySQLdb/_mysql.c index b222663..b721a66 100644 --- a/MySQLdb/_mysql.c +++ b/MySQLdb/_mysql.c @@ -471,13 +471,17 @@ _mysql_ResultObject_Initialize( return -1; } if (PyTuple_Check(t) && PyTuple_GET_SIZE(t) == 2) { - long mask; + long mask, flags; PyObject *pmask=NULL; pmask = PyTuple_GET_ITEM(t, 0); fun2 = PyTuple_GET_ITEM(t, 1); if (PyInt_Check(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); break; } -- cgit v1.2.1