Commits

adamv  committed a03554c

Put back command/parameter into the error message when something goes wrong executing the query. This information was accidentally lost when doing the execute/callproc refactoring.

  • Participants
  • Parent commits 83e5118

Comments (0)

Files changed (1)

File source/sqlserver_ado/dbapi.py

 import pythoncom
 pythoncom.__future_currency__ = True
 
-import pywintypes
-
 from ado_consts import *
 
 # DB API default values
             recordset = self.cmd.Execute()
             self.rowcount = recordset[1]
             self._description_from_recordset(recordset[0])
-        except pywintypes.com_error, e:
-            self._raiseCursorError(DatabaseError, e.args)
-        except:
-            self._raiseCursorError(DatabaseError, None)
+        except Exception, e:
+            _message = ""
+            if hasattr(e, 'args'): _message += str(e.args)+"\n"
+            _message += "Command:\n%s\nParameters:\n%s" %  (self.cmd.CommandText, format_parameters(self.cmd.Parameters, True))
+            self._raiseCursorError(DatabaseError, _message)
 
 
     def callproc(self, procname, parameters=None):