IBM / python-itoolkit

itoolkit is a Python interface to the XMLSERVICE toolkit for the IBM i platform.
MIT License
19 stars 13 forks source link

Fix database transport error #37

Closed ThePrez closed 5 years ago

ThePrez commented 5 years ago

Database transport was throwing the following error:

getattr(cursor, self.func)(cursor, self.query, parms)
TypeError: callproc() takes at most 3 arguments (4 given)

This is because cursor is the implicit "self" reference but also being explicitly passed

ThePrez commented 5 years ago

All the TravisCI builds are failing, so we need to look into those.

jkyeung commented 5 years ago

Um, are we completely sure the tests are correct? Judging by the release downloads, the tests changed drastically between 1.5.1 and 1.6.0. Which isn't surprising, given the significant refactoring that was done.

But if anything, the tests should be failing on the 1.6.0 release, because this bug is a showstopper. Out of the box, DatabaseTransport is not usable at all from my PC (with the iSeries Access ODBC driver). But when I apply this fix, it works.

[Edit: I can confirm the bug prevents proper operation on PASE as well, using ibm_db.]

ThePrez commented 5 years ago

I agree. Opened issue #38 for the test case. Will merge this PR

kadler commented 5 years ago

Wow, I really goofed that up. Apparently when you reference Python methods, it doesn't return the underlying function, but a function bound to its self so you don't need to pass it.