Menu

#10 Incorrect error message / IndexError creating error message

v1.0_(example)
closed
None
5
2014-07-14
2007-11-14
Anonymous
No

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]))

Discussion

  • Vernon Cole

    Vernon Cole - 2007-12-17
    • assigned_to: nobody --> kf7xm
     
  • Vernon Cole

    Vernon Cole - 2014-04-22

    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

     
  • Vernon Cole

    Vernon Cole - 2014-07-14

    Fixed and tested before version 2.6.0.7

     
  • Vernon Cole

    Vernon Cole - 2014-07-14
    • status: open --> closed
    • Group: --> v1.0_(example)
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.