Re: [cx-oracle-users] bug in Cursor_Execute when keywordArgs is empty
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2006-03-13 15:30:12
|
I have integrated the following patch (the line numbers won't match yours because I have other changes that I have already made) and added a test suite to verify that it works properly. --- Cursor.c 10 Mar 2006 16:38:55 -0000 1.95 +++ Cursor.c 13 Mar 2006 15:26:46 -0000 @@ -1317,9 +1317,13 @@ return NULL; } if (executeArgs && keywordArgs) { - PyErr_SetString(g_InterfaceErrorException, - "expecting argument or keyword arguments, not both"); - return NULL; + if (PyDict_Size(keywordArgs) =3D=3D 0) + keywordArgs =3D NULL; + else { + PyErr_SetString(g_InterfaceErrorException, + "expecting argument or keyword arguments, not both"); + return NULL; + } } if (keywordArgs) executeArgs =3D keywordArgs; On 3/11/06, Fabien Grumelard <fab...@gr...> wrote: > Hello, > > I use cx_Oracle 4.1.2 with DBUtils. There was an error when I wanted to > execute a query with a sequence parameter. For example, where 'cursor' is > a cursor from a PooledDB connection: > cursor.execute("select * from foo where login=3D:1", (['fabix'])) > produced a cx_Oracle.InterfaceError in > /usr/lib/python2.3/site-packages/DBUtils/SolidDB.py in > tough_method(*args, **kwargs) line 243: > --> r =3D method(*args, **kwargs) # try to execute > I found the problem is passing kwargs whereas it's empty. > I changed Cursor.c to solve it (from line 1276) : > ---------- > if (executeArgs && keywordArgs) { > if (PyDict_Size(keywordArgs) > 0) { > PyErr_SetString(g_InterfaceErrorException, > "expecting argument or keyword arguments, not bot= h"); > return NULL; > } > } > if (!executeArgs && keywordArgs) > executeArgs =3D keywordArgs; > ---------- > > Maybe someone else can be interested by this "patch". > > Regards, > Fabien Grumelard > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting langua= ge > that extends applications into web and mobile media. Attend the live webc= ast > and join the prime developer group breaking into this new coding territor= y! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |