One sql transaction on update form and many grids


Maybe someone had this problem and can help me :slight_smile:
For example, I have aplication on 3L layout.
In A-cell is grid (not editable)
In B-cell is form with few text fields (editable)
In C-cell is tabbar with two tabs

  • tab A - editable grid
  • tab B - another editable grid

Ok, problem is when I call update in aplication. Update’s in database are made separetly (by stored procedures), but there isn’t god way. In my aplication first is update form, than grid one, than grid two. But when something went wrong on second grid I would like to rollback also updates permormed by form and grid one.
I would get scenario like this:

  1. Push magic ‘save’ button :slight_smile:
  2. Start of sql transaction
  3. Call FormSave procedure in sql (return true- everything is ok)
  4. Call Grid1Save procedure in sql (return true- everything is ok)
  5. Call Grid2Save procedure in sql (return false- something was wrong)
  6. Rollback of transaction

My aplication is on php with mssql db if it something change. And I use php not only as connector to db, but as tool that dynamically generates dhtmlx code (I do not know if it’s god solution but but so far it works well) :slight_smile:

PS. I do not use dhtmlx connector, maybe it have option to made updates from few sources in one transaction…?

Best regards

Connector will not help, as it has transactions only on per-component basis.

As far as I can see - the only way is to accumulate all changes in all components in one single js object and send it to server side for saving ( components allows to get changes by their API ), and now when you have single set of data on server side - it is quite trivial to make a set of updates included in single db transaction.