Hello,

We had a problem with BIT data types in MySQL Connector/Python. A fix
was pushed today, but I can't still make this test_bit_50 (here below)
work.
It appears that what gets back from MySQL through RowProxy(?) is
'empty'. If anyone can hit me with the cluebat to figure out what's
wrong?

Also added here below is a patch for the test case and the
mysqlconnector dialect.

I still have 6 Errors when running the MySQL dialect tests (first
fixing these). Pretty good stuff!

-Geert

======================================================================
ERROR: test.dialect.test_mysql.TypesTest.test_bit_50
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/nose-0.11.1-py2.6.egg/nose/
case.py", line 183, in runTest
    self.test(*self.arg)
  File "/Users/geert/Projects/sqlalchemy-trunk/lib/sqlalchemy/test/
testing.py", line 236, in maybe
    return fn(*args, **kw)
  File "/Users/geert/Projects/sqlalchemy-trunk/test/dialect/
test_mysql.py", line 338, in test_bit_50
    roundtrip([0] * 8)
  File "/Users/geert/Projects/sqlalchemy-trunk/test/dialect/
test_mysql.py", line 334, in roundtrip
    print "Found %s" % list(row)
  File "/Users/geert/Projects/sqlalchemy-trunk/lib/sqlalchemy/engine/
base.py", line 1575, in __iter__
    yield func(row)
  File "/Users/geert/Projects/sqlalchemy-trunk/lib/sqlalchemy/engine/
base.py", line 1825, in getcol
    return processor(row[index])
  File "/Users/geert/Projects/sqlalchemy-trunk/lib/sqlalchemy/dialects/
mysql/base.py", line 561, in process
    for i in map(ord, value):
TypeError: argument 2 to map() must support iteration
-------------------- >> begin captured stdout << ---------------------
Storing [0, 0, 0, 0, 0, 0, 0, 0]
Expected [0, 0, 0, 0, 0, 0, 0, 0]




Index: test/dialect/test_mysql.py
===================================================================
--- test/dialect/test_mysql.py  (revision 6622)
+++ test/dialect/test_mysql.py  (working copy)
@@ -1199,11 +1199,22 @@
     def teardown_class(cls):
         metadata.drop_all()

+    @testing.fails_on('mysql+mysqlconnector', 'uses pyformat')
     def test_expression(self):
         format = testing.db.dialect.paramstyle == 'format' and '%s'
or '?'
         self.assert_compile(
             matchtable.c.title.match('somstr'),
             "MATCH (matchtable.title) AGAINST (%s IN BOOLEAN MODE)" %
format)
+
+    @testing.fails_on('mysql+mysqldb', 'uses format')
+    @testing.fails_on('mysql+oursql', 'uses format')
+    @testing.fails_on('mysql+pyodbc', 'uses format')
+    @testing.fails_on('mysql+zxjdbc', 'uses format')
+    def test_expression(self):
+        format = '%(title_1)s'
+        self.assert_compile(
+            matchtable.c.title.match('somstr'),
+            "MATCH (matchtable.title) AGAINST (%s IN BOOLEAN MODE)" %
format)

     def test_simple_match(self):
         results = (matchtable.select().
Index: lib/sqlalchemy/dialects/mysql/mysqlconnector.py
===================================================================
--- lib/sqlalchemy/dialects/mysql/mysqlconnector.py     (revision 6622)
+++ lib/sqlalchemy/dialects/mysql/mysqlconnector.py     (working copy)
@@ -66,11 +66,15 @@
         return connection.connection.get_characterset_info()

     def _extract_error_code(self, exception):
-        m = re.compile(r"\(.*\)\s+(\d+)").search(str(exception))
-        c = m.group(1)
-        if c:
-            return int(c)
-        else:
+        try:
+            return exception.orig.errno
+        except AttributeError:
             return None
+
+    def _compat_fetchall(self, rp, charset=None):
+        return rp.fetchall()

+    def _compat_fetchone(self, rp, charset=None):
+        return rp.fetchone()
+
 dialect = MySQL_mysqlconnector

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.


Reply via email to