Created
December 10, 2011 21:14
-
-
Save sevein/1456441 to your computer and use it in GitHub Desktop.
Change connection character set to utf8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: archivematicaCommon/lib/databaseInterface.py | |
| =================================================================== | |
| --- archivematicaCommon/lib/databaseInterface.py (revision 2013) | |
| +++ archivematicaCommon/lib/databaseInterface.py (working copy) | |
| @@ -32,6 +32,8 @@ | |
| global separator | |
| separator = "', '" | |
| +DB_CONNECTION_OPTS = dict(db="MCP", read_default_file="/etc/archivematica/archivematicaCommon/dbsettings", charset="utf8") | |
| + | |
| def getSeparator(): | |
| global separator | |
| return separator | |
| @@ -56,7 +58,7 @@ | |
| sqlLock = threading.Lock() | |
| sqlLock.acquire() | |
| global database | |
| -database=MySQLdb.connect(db="MCP", read_default_file="/etc/archivematica/archivematicaCommon/dbsettings") | |
| +database=MySQLdb.connect(**DB_CONNECTION_OPTS) | |
| sqlLock.release() | |
| def runSQL(sql): | |
| @@ -70,7 +72,7 @@ | |
| except MySQLdb.OperationalError, message: | |
| #errorMessage = "Error %d:\n%s" % (message[ 0 ], message[ 1 ] ) | |
| if message[0] == 2006 and message[1] == 'MySQL server has gone away': | |
| - database=MySQLdb.connect(db="MCP", read_default_file="/etc/archivematica/archivematicaCommon/dbsettings") | |
| + database=MySQLdb.connect(**DB_CONNECTION_OPTS) | |
| sqlLock.release() | |
| runSQL(sql) | |
| return | |
| @@ -94,7 +96,7 @@ | |
| except MySQLdb.OperationalError, message: | |
| #errorMessage = "Error %d:\n%s" % (message[ 0 ], message[ 1 ] ) | |
| if message[0] == 2006 and message[1] == 'MySQL server has gone away': | |
| - database=MySQLdb.connect(db="MCP", read_default_file="/etc/archivematica/archivematicaCommon/dbsettings") | |
| + database=MySQLdb.connect(**DB_CONNECTION_OPTS) | |
| import time | |
| time.sleep(10) | |
| c=database.cursor() | |
| @@ -120,7 +122,7 @@ | |
| except MySQLdb.OperationalError, message: | |
| #errorMessage = "Error %d:\n%s" % (message[ 0 ], message[ 1 ] ) | |
| if message[0] == 2006 and message[1] == 'MySQL server has gone away': | |
| - database=MySQLdb.connect(db="MCP", read_default_file="/etc/archivematica/archivematicaCommon/dbsettings") | |
| + database=MySQLdb.connect(**DB_CONNECTION_OPTS) | |
| import time | |
| time.sleep(10) | |
| c=database.cursor() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment