title: Why copy the state before updating the datawindow?
body: <p>I just ran across the following code in a legacy Powerbuilder app, and I'm wondering if there's any real need for it, or if someone was in a belt-and-suspenders mood.</p>
  
  <pre><code>// Create a datastore that we can capture database errors in
  lds_ds = create n_cst_base_datastore
  
  // set up the datastore with the state of the datawindow
  ll_Rc = adw_the_dw.GetFullState ( lblob )
  ll_rc = lds_ds.SetFullState(lblob)
  
  // set the transaction object
  li_rc = lds_ds.SetTransObject(sqlca)
  
  // call the update
  li_Rc = lds_ds.update()
  
  if li_rc = 1 then   // if successful then commit
      if ab_reset then
          adw_the_dw.ResetUpdate()
          COMMIT using sqlca;  // should check the commit return code
      end if
      li_return = 1
  elseif li_rc = -1 then  // otherwise show error message
      if lds_ds.of_get_error() then
          lnv_error.of_process_sql_error( lds_ds.of_get_sql_code(), lds_ds.of_get_sql_errtext() )
      end if
      ROLLBACK;
      li_return = -1
  else // better never happen
      ROLLBACK;
      li_return = -1
  end if
  </code></pre>
  
  <p>It looks to me like you could get the same effect by just updating the DataWindow directly in this case, since we're not coordinating between multiple DWs</p>