On Fri, Oct 17, 2008 at 04:32:00PM -0700, Toshio Kuratomi wrote:
> Oleg Broytmann wrote:
> >    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.

   AFAIK MySQLdb before 1.2.1 only allowed ascii query strings. So:

-- MySQLdb < 1.2.1: only ascii
-- MySQLdb = 1.2.1: only unicode
-- MySQLdb > 1.2.1: both ascii and unicode

   Right?

> >> +        if self.need_unicode and not isinstance(query, unicode):
> >> +            try:
> >> +                query = unicode(query, self.dbEncoding)
> >> +            except UnicodeError:
> >> +                pass

   What if the data cannot be converted (BLOB data, e.g.)? 'query' still
is ascii after that try/except. How would MySQLdb 1.2.1 react?

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
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