DATA lRaiseErrorDML INIT .f.
DATA lRaiseErrorALL INIT .f.
I can change the name of the variables to lThrowError, etc. if you all suggest
If programmer sets :lRaiseErrorDML := .t., then the Execute() method will raise a runtime error for failure of DML statements only ( DML: INSERT/UPDATE/DELETE ) and will be silent for errors with other SQL queries.
If programmer sets :lRaiseErrorALL := .t., then the Execute() method will raise a runtime error for failure in execution of any query.
Then we can write:
- Code: Select all Expand view
oCn:BeginTransaction()
oCn:lRaseErrorDML := .t.
TRY
oCn:Insert(...)
....
CATCH
lSaved := .f.
oCn:RollBack()
END
oCn:lRaiseErrorDML := .f.
if lSaved
oCn:CommitTransaction()
endif
Welcome any suggestions, before I finish the changes