Thread: Automated task

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    10
    Rep Power
    0

    Post Automated task


    HI, can i ask some help,...i have some sql statement that will delete records to the database.but i am confuse on this,what if the third sql statement failed to process and then the first and second delete statement are successfully deleted the records?.how can i return the data that was deleted...




    PHP Code:
      <cftry>
         <
    cfquery>
          
    // delete statement here

       
    </cfquery>

      <
    cfquery>
          
    // delete statement here

       
    </cfquery>

        <
    cfquery>
          
    // delete statement here

       
    </cfquery>

         <
    cfcatch type='Any'>

        <
    cfset log_error='#CFCATCH.Detail# #CFCATCH.Message#'>

         <
    cfquery name="automatedtask" datasource="#mysource#">
          
    //   INSERT statemnent here
         
    </cfquery
       </
    cfcatch>

     </
    cftry
    Thank you in advance.
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,265
    Rep Power
    968
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2008
    Posts
    131
    Rep Power
    7
    ,what if the third sql statement failed to process and then the first and second delete statement are successfully deleted the records?
    If the queries are related, you shouldn't let that happen. As kiteless mentioned, use a transaction to group them together.

IMN logo majestic logo threadwatch logo seochat tools logo