----- Forwarded message from Andy Dustman <[EMAIL PROTECTED]> -----

Date: Tue, 22 Mar 2005 11:28:35 -0500
From: Andy Dustman <[EMAIL PROTECTED]>
Subject: Re: [EMAIL PROTECTED]: Bug#300324: python-mysqldb: Python True is
 mysql false when inserting]
To: Jonas Meurer <[EMAIL PROTECTED]>

It's a valid point, although the fix is simpler than he thinks:

MySQLdb.converters.conversions[bool] = int

No need for the lambda.

I'll fix in the next release. It's a very easy fix in the above sub-module.

Jonas Meurer wrote:
>hi andy,
>
>i forward this bugreport to you, as i don't have time for debugging
>these days. i write my abitur these days. i'll have a further look in
>about one, two weeks.
>
>bye
> jonas
>
>ps: there is a second bugreport, it's about InnoDB, i'll forward it too.
>
>
>----- Forwarded message from Tim Freeman <[EMAIL PROTECTED]> -----
>
>Date: Fri, 18 Mar 2005 15:53:12 -0700
>From: Tim Freeman <[EMAIL PROTECTED]>
>From-Tims-Fingers: true
>Subject: Bug#300324: python-mysqldb: Python True is mysql false when 
>inserting
>To: [EMAIL PROTECTED]
>Reply-To: Tim Freeman <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
>
>Package: python-mysqldb
>Version: 1.1.6-1
>Severity: normal
>
>*** Please type your report below this line ***
>Using python2.3-mysqldb against mysql-server 4.1.9-2, I can run this program
>
>   import MySQLdb
>   import MySQLdb.converters
>   _conversions = MySQLdb.converters.conversions.copy()
>   # To make the bug go away, comment in the next line.
>   #_conversions[bool] = lambda x, d: int(x)
>   conn = MySQLdb.connect(host='x', user='x', passwd='x', db='x',
>                          conv = _conversions)
>   cursor = conn.cursor()
>   cursor.execute("drop table if exists foo");
>   cursor.execute("create table foo (x boolean)");
>   # Inserting a print statement strategically into the MySQLdb package 
>   shows
>   # that the next execute does this mysql: 
>   #    insert into foo(x) values ('True');
>   # which, when I do it directly from the mysql command line, inserts a 0 
>   into
>   # foo, not a 1.
>   cursor.execute("insert into foo (x) values (%s)", (True,))
>   cursor.execute("select * from foo")
>   (value,) = cursor.fetchone()
>   print "Value is %r" % (value,) # prints 0, should print True or 1.
>   assert value
>
>and it hits the assert because inserting True inserts a 0 into the database.
>There's a workaround commented out at the top of the script.
>
>-- System Information:
>Debian Release: 3.1
>  APT prefers testing
>  APT policy: (700, 'testing')
>Architecture: i386 (i686)
>Kernel: Linux 2.6.8-1-386
>Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
>
>Versions of packages python-mysqldb depends on:
>ii  python                        2.3.4-5    An interactive high-level 
>object-o
>ii  python2.3-mysqldb             1.1.6-1    A Python interface to MySQL
>
>-- no debconf information
>
>
>----- End forwarded message -----


----- End forwarded message -----


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to