Menu

Rollback failing on ctypes mysql port

2009-06-29
2012-09-19
  • Jason R. Coombs

    Jason R. Coombs - 2009-06-29

    I've made some good progress on the ctypes-based port of _mysql.c. For reference, the latest code is at https://svn.jaraco.com/projects/python/jaraco.mysql .

    I've managed to get it to pass all of the tests in MySQLdb/tests/test_MySQLdb_capabilities.py except for one, the rollback test (test_transactions). It fails at tests/capabilities.py:135.

    So it appears that connection.rollback() is executing without an error, but the DELETE operation has not been rolled back.

    I suspect the problem is within the implementation of _mysql.py, but I wanted to post here to see if adustman had any suggestions on what would be the most likely cause of this problem. I suspect it may be one of

    • The connection is not properly configured to enable transactions.
    • The cursor and connection are out of sync due to an error in the _mysql implementation.
    • MySQL versions are out of sync (server is 5.0 but client DLL is 5.1).

    I'll certainly track this down on my own, but I'd very much appreciate any suggestions on where to look.

     
    • Andy Dustman

      Andy Dustman - 2009-07-03

      Are you implementing the connection.autocommit() method? I'd look there, but your SVN server requires a login.

       
      • Jason R. Coombs

        Jason R. Coombs - 2009-07-03

        Sure enough, like an idiot, I sent the wrong URL.

        https://svn.jaraco.com/jaraco/python/jaraco.mysql

        I have implemented the connection.autocommit method. Interestingly, if I add self.connection.autocommit(False) to capabilities.py/DatabaseTest/test_transactions, all tests pass. Hooray!

        I think the problem lies in that the _mysql.connection object isn't properly returning the server_capabilities property, so transactions aren't being disabled.

        Thanks for the tip. This gives me a good lead.

         
      • Jason R. Coombs

        Jason R. Coombs - 2009-07-04

        It turns out I was conflating two variables - I was testing on one machine and implementing fixes on another (due to the fact that I don't have a reference implementation working on 64-bit Windows). The rollback error appears to be correct. The 64-bit environment I have returns a server_capabilities indicating no transaction support. On the 32-bit environment, however, all of the tests are now passing without any semantic changes to the MySQLdb implementation.

        I've released the first 1.0 release of jaraco.mysql at http://pypi.python.org/pypi/jaraco.mysql/1.0 so feel free to check this out. It's built against the 1.2.3c1 release of MySQLdb. Unix support is still lacking, but nominal support is in place. I'll be looking into full Unix support and testing this against the trunk of mysql-python in the future.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.