Commit acba50c2 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Force array to be converted to str. This is required for blobs.

git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@128 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 5d7fe1b4
......@@ -2,6 +2,7 @@ import MySQLdb
from MySQLdb import OperationalError
from MySQLdb.constants.CR import SERVER_GONE_ERROR, SERVER_LOST
import logging
from array import array
from neo.storage.database import DatabaseManager
from neo.exception import DatabaseFailure
......@@ -55,7 +56,16 @@ class MySQLDatabaseManager(DatabaseManager):
conn.query(query)
r = conn.store_result()
if r is not None:
r = r.fetch_row(r.num_rows())
new_r = []
for row in r.fetch_row(r.num_rows()):
new_row = []
for d in row:
if isinstance(d, array):
d = d.tostring()
new_row.append(d)
new_r.append(tuple(new_row))
r = tuple(new_r)
except OperationalError, m:
if m[0] in (SERVER_GONE_ERROR, SERVER_LOST):
logging.info('the MySQL server is gone; reconnecting')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment