Oleg Broytmann wrote:
> On Fri, Oct 17, 2008 at 03:17:28PM -0700, Toshio Kuratomi wrote:
>> +        if MySQLdb.version_info[:3] >= (1, 2, 1) and 
>> MySQLdb.version_info[:3] < (1, 2, 2):
>> +            self.need_unicode = True
>> +        else:
>> +            self.need_unicode = False
> 
>    Unicode is required for MySQLdb 1.2.1 and 1.2.2beta, but not for
> 1.2.2final and up? Did I read it right?
> 
The requirement that this not be used on < 1.2.1 existed in the old
code.  I'm assuming that it was there for a practical reason; I haven't
downloaded MySQL-python-1.2.0 to check.

The fix that allows MySQL-python to accept either unicode or byte
strings was applied in time for 1.2.2.  There is no 1.2.2beta release on
sourceforge so, unless there's another place to download it, the upper
bound should be correct.

>> +        if self.need_unicode and not isinstance(query, unicode):
>> +            try:
>> +                query = unicode(query, self.dbEncoding)
>> +            except UnicodeError:
>> +                pass
> 
>    Another question: do I understand it right that MySQLdb *allows* unicode
> query strings but doesn't *require* them? Becasue my (humble and
> uninformed) opinion is to use that "loophole" and do not use unicode with
> MySQLdb (yet).

You have it backwards.  In MySQL-python-1.2.1 the query string was
required to be unicode.  Sending in a byte string with non-ASCii causes
an error to be raised.

I do not know if MySQL-python < 1.2.1 had the opposite problem but the
lower bound version check in the previous chunk makes me suspicious that
that was the case.

-Toshio

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to