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


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

Reply via email to