Topic
2 replies Latest Post - ‏2010-05-18T08:06:46Z by SystemAdmin
SystemAdmin
SystemAdmin
532 Posts
ACCEPTED ANSWER

Pinned topic how to check an update operation is successful ?

‏2010-05-15T15:47:04Z |
Hello,

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.

any ideas?
Updated on 2010-05-18T08:06:46Z at 2010-05-18T08:06:46Z by SystemAdmin
  • DGawron
    DGawron
    251 Posts
    ACCEPTED ANSWER

    Re: how to check an update operation is successful ?

    ‏2010-05-17T19:25:06Z  in response to SystemAdmin
    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.
    • SystemAdmin
      SystemAdmin
      532 Posts
      ACCEPTED ANSWER

      Re: how to check an update operation is successful ?

      ‏2010-05-18T08:06:46Z  in response to DGawron
      It sounds great !

      thanks a lot !!