How to save information on a Sophis Risque instrument after a commit?
3/5/2013 12:16 PM
Sometimes, we need to save informations ourselves in some Oracle table without using the mapping between some CSREdit control and some field in the Oracle TITRES table. Sadly, on Sophis Risque, and despite several requests I made, there is no specific callback to implement for the Oracle rollback or commit. Thus, the only way to implement the save of additional informations, and recommended by Sophis, is the following one:
1 - Add a C++ trigger using CSRInstrumentAction and override NotifyCreated and NotifyModified.
2 - Create a new class derivated from CSRAbstractEvent and override the Send method.
3 - on NotifyCreated and NotifyModified, add some piece of code like that:
CSRInstrument &instrument, CSREventVector & message)
CMyEvent* _event =
//_event->SetAdditionalInfo(); // some other accessor can be added and used for additional information too
4 - when Sophis Risque will save the instrument successfully, the Send method of the CSRAbstractEvent will be called. On this method, we can now implement the save of additional informations.
5 - Since the Commit was already called by Sophis before, the CSRSqlQuery::Commit method should be called additionnally in the Send method. Be sure that only one event is added too.
Note that if the code is implemented directly on NotifyCreated and NotifyModified, the rollback and commit are directly done by Sophis. Concerning the deletion of instruments (not really permitted by some client), additional informations have to be deleted, of course, using the same mechanism.