waliwali / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

ibm_db_dbi - remove duplicate Cursor contructor #108

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Cursor class has duplicate constructor, see:

http://code.google.com/p/ibm-db/source/browse/trunk/IBM_DB/ibm_db/ibm_db_dbi.py#
1053

First cursor will never be called, example:

class Test(object):
    def __init__(self, x,y):
        print 1, x,y
    def __init__(self, x,y,z):
        print 2, x,y,z

Test("a", "b")
# reports: TypeError: __init__() takes exactly 4 arguments (3 given)
Test("a", "b", "c")
# returns: 2 a b c

Right way to do it is with optional params, example:

class Test(object):
    def __init__(self, x,y,z=None):
        print 2, x,y,z
Test("a", "b")
# returns: 2 a b None
Test("a", "b", "c")
# returns: 2 a b c

Solution: remove first contructor and if this mode is needed, in second 
constructor make last param optional with default value.

Original issue reported on code.google.com by trebor74hr@gmail.com on 2 May 2012 at 10:27

GoogleCodeExporter commented 9 years ago
Thanks robert this figure out this problem, we will fix this in our next 
release. 

Original comment by rahul.pr...@in.ibm.com on 8 May 2012 at 9:39

GoogleCodeExporter commented 9 years ago
Released with ibm_db-1.0.6

Original comment by rahul.pr...@in.ibm.com on 25 May 2012 at 6:50