I create a service provider which updates a record in db, if the update condition does not match, then insert this record into table.
I used transaction to update/insert my new records.
Pinned topic how to check an update operation is successful ?
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2010-05-18T08:06:46Z at 2010-05-18T08:06:46Z by SystemAdmin
DGawron 10000054HC251 Posts
Re: how to check an update operation is successful ?2010-05-17T19:25:06ZThis is the accepted answer. This is the accepted answer.Here is a sample model that illustrates part of the process you should follow. It uses a SQL Transaction builder with a single step that defines a custom result transform method. This transform method executes some SQL (in your case it will be an UPDATE) and then saves the resulting update count to a variable.
You'll need to modify the model so that as part of the transaction you first execute the UPDATE step (which saves the update count using the custom transform method), test the update count, and if found to be zero then you execute the INSERT transaction step. Finally, you either commit the transaction or rollback on error.