If you call a stored procedure which has a return value and one of your input parameters is in an incorrect format, then adbodbapi 2.1 has problems creating the error message. Either an incorrect error message is generated or it crashes trying to create the error message.
E.g. 1
-- Trying parameter 2 = 'Foobar'
Traceback (most recent call last):
File "c:\python23\Lib\site-packages\adodbapi\adodbapi.py", line 637, in _executeHelper
p.Value = elem[:L] #v2.1 Jevon & v2.1 Cole
File "c:\python23\lib\site-packages\win32com\client\__init__.py", line 463, in __setattr__
self._oleobj_.Invoke(*(args + (value,) + defArgs))
com_error: (-2147352567, 'Exception occurred.', (0, 'ADODB.Parameter', 'Application uses a value of the wrong type for the current operation.', 'C:\\WINDOWS\\HELP\\ADO270.CHM', 1240652, -2146824867), None)
-- on command: "sp_xxx"
-- with parameters: ['yyy', '2007-11-14 00:00:00', 'Foobar', -1354840051, '2007-11-14 09:06']
The actual problem was with the previous parameter (a string was passed instead of a datetime) - ‘Foobar’ was fine.
E.g. 2
If the last parameter is incorrect, an IndexError is generated:
File "c:\python23\Lib\site-packages\adodbapi\adodbapi.py", line 488, in callproc
return self._executeHelper(procname,True,parameters)
File "c:\python23\Lib\site-packages\adodbapi\adodbapi.py", line 655, in _executeHelper
tbk += u'-- Trying parameter %d = %s\n' \
IndexError: list index out of range
The problems appear to be caused around line 616 of adodbapi.py:
if parmIndx == returnValueIndex:
parmIndx+=1
p=self.cmd.Parameters(parmIndx)
And line 654:
if parmIndx >= 0:
tbk += u'-- Trying parameter %d = %s\n' \
%(parmIndx, repr(parameters[parmIndx]))
This error was fixed as a side-effect of general clean-up of the parameter building routine. Specific regression tests for the fix are being added in 2.6.0
Fixed and tested before version 2.6.0.7