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 ...@@ -2,6 +2,7 @@ import MySQLdb
from MySQLdb import OperationalError from MySQLdb import OperationalError
from MySQLdb.constants.CR import SERVER_GONE_ERROR, SERVER_LOST from MySQLdb.constants.CR import SERVER_GONE_ERROR, SERVER_LOST
import logging import logging
from array import array
from neo.storage.database import DatabaseManager from neo.storage.database import DatabaseManager
from neo.exception import DatabaseFailure from neo.exception import DatabaseFailure
...@@ -55,7 +56,16 @@ class MySQLDatabaseManager(DatabaseManager): ...@@ -55,7 +56,16 @@ class MySQLDatabaseManager(DatabaseManager):
conn.query(query) conn.query(query)
r = conn.store_result() r = conn.store_result()
if r is not None: 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: except OperationalError, m:
if m[0] in (SERVER_GONE_ERROR, SERVER_LOST): if m[0] in (SERVER_GONE_ERROR, SERVER_LOST):
logging.info('the MySQL server is gone; reconnecting') 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