nextresult method in _mssql connect always returns True, and never points to next result set if there is any more

Bug #633882 reported by Steger Jozsef
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pymssql (Ubuntu)
New
Undecided
Unassigned

Bug Description

Dear Maintainer,

I am struggling with a strange issue concerning python-pymssql package, which may be related to bux #463830 The problem questions the usability of the module. It occurs when importing and using the native _mssql module from the up-to-date (python-pymssql 1.0.2+dfsg-1) version of the package.

Problems:
* It seems that only the first result set of a query is retrievable,
* The nextresult() method of the connection will always return True and will not point to the next result set if any.

System:
$ lsb_release -rd
Description: Ubuntu 10.04.1 LTS
Release: 10.04
$ apt-cache policy python-pymssql
python-pymssql:
  Installed: 1.0.2+dfsg-1
  Candidate: 1.0.2+dfsg-1
  Version table:
 *** 1.0.2+dfsg-1 0
        500 http://hu.archive.ubuntu.com/ubuntu/ lucid/universe Packages
        100 /var/lib/dpkg/status

Note, I tried to compile the new version of python-pymssql from http://code.google.com/p/pymssql/downloads/detail?name=pymssql-1.9.908.tar.gz&can=2&q= but the cython package required and available in the distribution conflicts in version.

The sequence of commands to generate erronous behaviour:
#####################################################
$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import _mssql
>>> C=_mssql.connect(user='d2ruser', password='XXX', server='XXX', database='XXX')
>>> C.execute_query('SELECT current_user; SELECT GETDATE();')>>> for r in C: print r
...
{0: 'd2ruser'}
>>> C.nextresult()
1
>>> for r in C: print r
...
>>> C.nextresult()
1
>>> C.nextresult()
1
>>>
#####################################################

As a comparison the same command set works in debian lenny (with python-pymssql 1.0.1+dfsg-1):
#####################################################
$ python
Python 2.5.2 (r252:60911, Jan 4 2009, 17:40:26)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import _mssql
>>> C=_mssql.connect(user='d2ruser', password='XXX', server='XXX', database='XXX')
>>> C.execute_query('SELECT current_user; SELECT GETDATE();')
>>> for r in C: print r
...
{0: 'd2ruser'}
>>> C.nextresult()
1
>>>
>>> for r in C: print r
...
{0: datetime.datetime(2010, 9, 9, 9, 50, 47, 27000)}
>>> C.nextresult()
>>> print C.nextresult()
None
>>>
#####################################################

Please consider packaging a newer version of the sources.

Thanks. Kind regards,
 S.J.

Revision history for this message
Steger Jozsef (steger) wrote :

I found a binary package that was required to successfully compile the up-to-date pymssql sources.
(https://launchpad.net/ubuntu/+source/cython/0.12.1-1.1/+build/1723320/+files/cython_0.12.1-1.1_amd64.deb)

Now in pymssql-1.9.908 this issue is not there any more, nextresult() operates as expected, and one can perfectly iterate over all result sets.

So presumably re-packaging python-pymssql will solve this sort of bug.

Kind regards,
 S.J.

Revision history for this message
Peter Schwenke (bluetoad) wrote :

I have it packaged in my PPA because I needed to solve #463830

https://launchpad.net/~bluetoad/+archive/ppa

It has been heavily tested.

The 1.02 package really does not work at all.

I also sent email to the maintainer, Josselin Mouette, in June with the new package files so that it could be packaged for Debian and find its way to Ubuntu, eventually.

From experience, Ubuntu generally don't update to new versions in releases. It is documented at https://wiki.ubuntu.com/StableReleaseUpdates.

However, since the bug has never been triaged to critical it makes it hard to start the SRU process.

Revision history for this message
Steger Jozsef (steger) wrote :

Dear Peter,

I happen to need working python-pymssql package again with which long ago you helped me out.

I was upgrading to Ubuntu oneiric, and have access to Ubuntu precise machines, where in either cases this original problem is still there, and I guess your fixes did not penetrate either. ;(

I was wondering if you have resources or do you think it'd make sense supporting this package for new(er) versions of Ubi? Please, let me know.

Best regards,
 S.J.

Revision history for this message
Peter Schwenke (bluetoad) wrote :

Hello S.J,

I checked in Debian (http://packages.debian.org/squeeze/python-pymssql), and the version has never shifted. I suppose the package is no longer actively maintained in Debian. Therefore, it won't get to Ubuntu.

I am still on Lucid and will probably move from Ubuntu when I need to upgrade. I also don't have access to a SQL Server machine to test.

I did put a later version of Ubuntu in a VM to have a look at it. If I get a chance next week, I'll have a look for the VM and see which version it was and maybe try building this package. But I am really tight for time at the moment.

Sorry, I can't be more help.

Revision history for this message
Steger Jozsef (steger) wrote :

Dear Peter,

thanks much for being helpful and prompt on my notice so fast.

I compiled the shared objects of the module for my environments, so my wish is of lower priority ;) Although, honestly, I have tested my compilation only for few cases and did not do it so professional. So still, if you find time later to nicely package it I'm pretty sure to move for it. :) Thank you again in advance.

I see the package is not maintained actively any longer and even the sources of the code are updated quite long ago... I wonder how to stress in a forum to replace the not working stuff with the latest one, otherwise having a not working package in a distribution is rather deluding ;)

Bests,
 Józsi

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.