Here's the basics of the system we have in place today. We have a SQL 2005/2008 table defined as:
CREATE TABLE [dbo].[Profiles] (
[Firm] [char] (4) NULL ,
[Account] [char] (10) NOT NULL ,
[UndSym] [char] (24) NOT NULL ,
[Updated] [timestamp] NOT NULL ,
[Data] [image] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
The Data field is a BLOB. It is where virtually all the goodies are. The data in the BLOB is compressed text which looks very similar to an INI file, with key-value pairs within sections. The internal layout of this INI file is quite complex however with much inter-related data.
We also have another product family which is completely different in design, implementation, and target audience. But now we have a client coming online who wants to integrate the two systems at the database level.
My system is MSSQL. The other system is MySQL. Between the two sits a custom middleware solution of our own design. I don't want to connect to MySQL directly, and they don't want to connect directly to me, for various reasons which are sound and are beyond the scope of this conversation, so don't worry about that.
The concept is simple. When a row in my Profiles table is touched, I need to rip thru the BLOB and look for a few bits of data. If those bits of data has changed, I need to send just those bits of data (not the whole BLOB) to the middleware piece. I must only do this when there are changes I'm interested in, and the only way I can do that is to process both blobs (the original and the replacement).
I quickly concluded that using T-SQL to process the BLOB is not the road I want to go down. I need to write custom code, and I am constrained to using either unmanaged C++, managed C++ or C# to do it.
There are a couple questions here.
FIRST: Should I use an INSTEAD OF trigger to, well, trigger the code which will compare the BLOBs and send interesting data? I know there are some extremist schools of thought on triggers: some people think they are pure Evil, others think they are awesome. The truth is somewhere in between. If I don't use a trigger, how can I trigger processing the BLOBs?
SECOND: Should I use:
- An Extended Stored Procedure, written in unmanaged C++?
- A CLR Stored Procedure written in either Managed C++ or C#?
- Something else?
...to do the actual processing of the BLOBs and sending the data to the middleware?