On 27/11/2007, Markus Gritsch <[EMAIL PROTECTED]> wrote:
> On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> > On Tue, Nov 27, 2007 at 08:04:10PM +0100, Markus Gritsch wrote:
> > > On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> > > import MySQLdb
> > >
> > > x = MySQLdb.connect(db='test', user='markus', charset='utf8') #
> > > supplying charset implies use_unicode=True
> > > c = x.cursor()
> > >
> > > c.execute('DROP TABLE person')
> > > c.execute('CREATE TABLE person(id int, name varchar(20))')
> > > c.execute('INSERT INTO person (id, name) VALUES (%s, %s)', (0, '\x61'))
> > > c.execute('SELECT * FROM person')
> > >
> > > value = c.fetchone()[-1]
> > > assert value == '\x61' # ok
> > > print value # -> a
> > >
> > > c.close()
> > > x.commit()
> > > x.close()
> >
> >    Thank you! So we can remove "need_unicode" at all, and rely on
> > "use_unciode", right?
>
> use_unicode specifies only if MySQLdb should *return* string values as
> unicode or as strings.  Queries can be issued using unicode or string
> regardless of this parameter.  Please read the two paragraphs from the
> MySQLdb doku I posted before.

And yes, IMO need_unicode should be dropped.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to