Patches item #1653898, was opened at 2007-02-07 10:57
Message generated for change (Comment added) made by phd
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1653898&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Maxim F. Ischenko (mfi)
>Assigned to: Oleg Broytmann (phd)
Summary: proper init mysql conn encoding
Initial Comment:
Current implementation of the mysqlconnection.py accepts 'sqlobject_encoding' and 'charset' parameters but doesn't quite properly use them.
In particular, MySQLdb does query.encode(charset) call in execute() where charset is taken from conn.get_character_name(). The problem is - SQLObject never initializes it properly.
This one-line patch fixes it by adding a call to conn.set_character_set() in makeConnection() helper.
Index: sqlobject/mysql/mysqlconnection.py
===================================================================
--- sqlobject/mysql/mysqlconnection.py (revision 2269)
+++ sqlobject/mysql/mysqlconnection.py (working copy)
@@ -62,6 +62,8 @@
if hasattr(conn, 'autocommit'):
conn.autocommit(bool(self.autoCommit))
+ conn.set_character_set(self.encoding)
+
return conn
def _setAutoCommit(self, conn, auto):
----------------------------------------------------------------------
>Comment By: Oleg Broytmann (phd)
Date: 2007-02-07 11:34
Message:
Logged In: YES
user_id=4799
Originator: NO
Thank you. Does all MySQLdb versions have the call or have I test "if
hasattr(conn, 'set_character_set')"?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1653898&group_id=74338
|