I have some existing queries with keyword (":THIS") parameters which I'm trying to move to adodbapi.
Most of the queries worked fine with paramstyle "named" but some would crash with an error for the SQL server about invalid ":". I've looked through the code and the change to qmark was happening fine with these vlaues.
There's a bit in adodbapi.py where.
self.command = operation #<- This seems to be in the wrong place. Or this variable is being used somewhere it shouldn't be. self._parameter_names = [] if parameters and self.paramstyle != 'qmark': operation = self._reformat_operation(operation, parameters) self.command = operation #<- Works.
If that makes sense? I wouldn't see why certain queries were using the converted text and others weren't but setting the command variable to the converted text seems to solve it. My comment about the wrong variable possibly being used was that I think with "self._new_command(operation)" this shouldn't have been needed.
The trace related to this is:
File "c:\python27\lib\site-packages\adodbapi\adodbapi.py", line 871, in execute
self._execute_command()
File "c:\python27\lib\site-packages\adodbapi\adodbapi.py", line 688, in _execute_command
self._raiseCursorError(klass, _message)
File "c:\python27\lib\site-packages\adodbapi\adodbapi.py", line 561, in _raiseCursorError
eh(self.connection, self, errorclass, errorvalue)
File "c:\python27\lib\site-packages\adodbapi\apibase.py", line 53, in standardErrorHandler
raise errorclass(errorvalue)
adodbapi.apibase.DatabaseError: (-2147352567, 'Exception occurred.', (0, u'Microsoft SQL Server Native Client 11.0', u"Incorrect syntax near ':'.", None, 0, -21
47217900), None)
Thank you. I have refactored this area.