Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


 
Reserves exclusive write privileges to an arbitrary number of models.
Any number of clients may open a model for write access at the same time. This is possible because all persistant changes within models must be done within a model write transactions. Conflicts are avoided by only allowing one open model write transaction within each model at any point of time. If a client attempts to start a model write transaction on a selected group of models while an other client has already reserved exclusive write privileges for him self by starting a model write transaction within one or more of these models, the first client will have to wait until the ongoing transaction is either committed or aborted.
In order to start a model write transaction on a selected group of models, all the models must be opened for write.
Ordinary transactions may be nested within a model write transaction with edmiStartTransaction. However, model write transactions may not be nested within ordinary transactions.
Closing a model write transaction is done by one of the following EDMInterface operations; edmiCommitTransaction, edmiAbortTransaction, edmiCommitAllTransactions, edmiAbortAllTransactions
Related functions: edmiStartModelWriteTransaction.
Header:
#include "sdai.h"
Prototype:
EdmiError edmiStartModelsWriteTransaction(SdaiModel *modelIds);
Arguments:

*modelIds

Zero terminated buffer of modelIds.
Numeric modelIDs uniquely identify data models in the EDMdatabase .
The modelID is returned from the functions: sdaiCreateModel , sdaiCreateModelBN , sdaiOpenModelBN , edmiGetModel , edmiGetModelBN , sdaiGetInstanceModel

Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an EDMinterface error code. Use edmiGetErrorText to get the error text corresponding to the error code.
EXAMPLE
EdmiError rstat;
SdaiModel modId[3];
. . .
modId[0] = edmiGetModelBN("ourRepository", "myModel");
modId[1] = edmiGetModelBN("ourRepository", "yourModel");
modId[2] = 0;
 
/* Start outer model write X-action */
if (edmiStartModelsWriteTransaction(modId)) {
printf("\nError %d in edmiStartModelsWriteTransaction: %s, rstat,
edmiGetErrorText(rstat)); 
goto error; 
}
/* Nested X-actions */
edmiStartTransaction();
. . .
if (rstat) {
edmiAbortTransaction(); 
} else {
edmiCommitTransaction(); 
}
/* Commit outer model write X-action */
edmiCommitTransaction();
. . .

  • No labels