Menu

#120 v1.1.8: Cursor bug (and possible fix) for multi-statements

MySQLdb-1.1
closed
MySQLdb (285)
5
2012-09-19
2005-01-08
robinsmb
No

Using multi-statement support ,
client_flag=CLIENT.MULTI_STATEMENTS, does not work with
the standard Cursor type. It does work with a custom cursor
composed as:

class CursorStandardUseResults(CursorUseResultMixIn,
CursorTupleRowsMixIn, BaseCursor): pass

version info:

mysql-python-test-1.1.8

Python 2.4 (#1, Jan 2 2005, 09:38:24)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2

Its an FC2 box.

mysql client and server 4.1.7-standard.

server is Linux (FC2) Kernel 2.6.5-1.358

The fix, I think, is to add the following two lines to the
implementation of CursorStoreResultMixIn.nextset, imediately
after _do_get_result at line 49ish.

# compliment what hapens in CursorStoreResultMixIn _query
override.

self._rows = self._fetch_row(0)

self._result = None

The atatched python file includes test cases, examples, and the
above 'fix'. It also has a comment in it (line 105) worying about
mysql_free_result and the lifecycle of the ResultObject - which I
can't seem to FOR-GET now I've seen it ;-)

Discussion

  • robinsmb

    robinsmb - 2005-01-08

    repro, test cases, and the above 'fix'.

     
  • Andy Dustman

    Andy Dustman - 2005-01-09

    Logged In: YES
    user_id=71372

    I'll look at this in more detail tomorrow.

     
  • Andy Dustman

    Andy Dustman - 2005-01-23

    Logged In: YES
    user_id=71372

    I think I fixed this; please reopen if you find otherwise.

     

Log in to post a comment.