DataSourceSave

Note: This page includes content based on the F1 documentation for Centura development. It may be partially converted to support APF development, but should be regarded to be of uncertain actuality. It is provided as is. Eventually, it should be replaced by documentation available from within Visual Studio.

SalNumber DataSourceSave( SalNumber nWhat )

Applications and the framework call the DataSourceSave method to save all changes in a top-level window.

Parameters

Name Description
SalNumber nWhat Standard method parameter. Possible values are Const.METHOD_Inquire, Const.METHOD_Execute, Const.METHOD_GetType.

Returns

When nWhat = Const.METHOD_Inquire: the return value is true if any changes have been made in the data source.

When nWhat = Const.METHOD_Execute: the return value is true if entire save transaction is successful and all changes have been committed.

When nWhat = Const.METHOD_GetType, the return value is Const.CHILDTYPE_SourceMethod.

Comments

The DataSourceSave is the start of the save process. It will perform client and server validation of all data sources (in the master-detail chain), start a transaction, save all changes, and commit or rollback the transaction.

Saving of changes is done in the following way:

  1. Call DataSourceValidate to perform client validation
  2. Call DataSourceSaveCheck to perform server validation
  3. Begin transaction
  4. Call DataSourceSaveLock to lock records
  5. Call DataSourceSaveRemoved to save removed records
  6. Save current client values of records to be modified
  7. Call DataSourceSaveModified to save modified records
  8. Call DataSourceSaveNew to save new records
  9. Call DataSourceSaveCheckOk to check that save process was successful
  10. End (commit) or clear (rollback) the transaction.
  11. In the case of a rollback, restore the saved client values for all modified records. This in fact carries out a client rollback.

Each of these nine steps is executed for all data sources in the master-detail chain before the next steps begin. For instance, validation is performed for all data sources before the transaction begins.

DataSourceSave is called automatically by the framework when a data source receives the PM_DataSourceSave message.