On 4/24/07, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> What do you think of this one?
> http://sourceforge.net/tracker/index.php?func=detail&aid=1653898&group_id=74338&atid=540674
>
> Can you test it?
I applied it and looked at the changes it makes. The last hunk
def _setAutoCommit(self, conn, auto):
@@ -71,13 +84,11 @@
def _executeRetry(self, conn, cursor, query):
while 1:
try:
- if self.need_unicode:
- # For MysqlDB 1.2.1 and later, we go
- # encoding->unicode->charset (in the mysql db)
- myquery = unicode(query, self.encoding)
- return cursor.execute(myquery)
- else:
- return cursor.execute(query)
+ # For MySQLdb 1.2.1 and later, we go
+ # encoding->unicode->charset (in the mysql db)
+ if self.need_unicode and not isinstance(query, unicode):
+ query = unicode(query, self.dbEncoding)
+ return cursor.execute(query)
except MySQLdb.OperationalError, e:
if e.args[0] == 2013: # SERVER_LOST error
if self.debug:
is exactly the one I proposed plus some code cleanup. This is ok and
suffices to make my test-code work. As for the other hunks, well I
cannot say much.
It seems that it includes some MySQLdb version check which uses SET
NAMES for versions pre 1.2.1 to set the encoding. I cannot test this,
since I never used that old connector version. I used 1.2.1 beta for
over a year, and since 1.2.2 came out recently, I switched to that
one.
Next, the patch contains some code to eliminate the possibility that
the connection parameters 'charset' and 'sqlobject_encoding' can be
different, although not popping both of them if they are both present.
This leads to an error message when both are specified:
TypeError: __init__() got an unexpected keyword argument 'sqlobject_encoding'
Further I thought that 'charset' is the MySQL encoding and
'sqlobject_encoding' is the one used by SQLObject. I thought that
both have a right to exist. The patch unifies them to one parameter,
and I have no idea if this is a good or a bad thing.
And last, the patch adds a new UnicodeStringLikeConverter which
encodes to 'utf8' hardcoded. I doubt that this is the correct thing
to do under all circumstances.
Just my 2 Cent,
Markus
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss