It’s time for another episode in the continuing saga of “doing stupid things in stored procedures.”
My colleague is looking at some code that we need to modify with a temporary fix. The legacy system calls into a stored procedure which then takes the arguments coming in and passes them to a COM object (via DCOM) to send an email (it also decides whether to send the email). The COM object promptly opens up a database connection to go back to the very same database to get more information in order to create an email. And of course there’s the issue that the stored procedure is called from middle tier code to begin with. WTF. There are so many things wrong with this scenario that I don’t even know where to begin.