platiumky / pymssql

Automatically exported from code.google.com/p/pymssql
GNU Lesser General Public License v2.1
0 stars 0 forks source link

fetchmany behaviour is not compliant with PEP249 #73

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. run a query with x records in the result
2. run fetchmany(y) where y is not divisor of x until you get the exception

What is the expected output? What do you see instead?

I expect:
-3rd call:   last incomplete set with data
-2nd call:    [] - empty set
-1st call:   exception

I see:
-2nd call:   last incomplete set with data
-1st call:   exception

What version of the product are you using? On what operating system?

1.0.2-4.fc15, Fedora 15

Please provide any additional information below.

Implementation consistent with PEP allows:

while 1:
    d = cursor.fetchmany(y)
    if not d:  break
    ... do other stuff

Current implementation requires additional ugly check for data set 
incompletness:

while 1:
    d = cursor.fetchmany(y)
    if d:
        ... do other stuff
    if len(d)<y: break

Original issue reported on code.google.com by jacek.pl...@gmail.com on 5 Nov 2011 at 8:16

GoogleCodeExporter commented 8 years ago
That version of pymssql is no longer supported.  Please try one of the 2.0 beta 
builds or build from HG tip.  If the problem persists, please post back.

Original comment by rsyr...@gmail.com on 7 Nov 2011 at 1:31

GoogleCodeExporter commented 8 years ago
I checked current HG version pymssql-2.0.0b1_dev_20111107-1 and it is fixed.

Original comment by jacek.pl...@gmail.com on 7 Nov 2011 at 8:03