sdaiDeleteInstance


Deletes an application instance in the actual EDMdatabase. All data, included all aggregates, owned by the actual instance will be deleted as well.
The actual instance cannot normally be deleted if it is referenced by another instance, i.e. the actual instance has at least one relation with another instance. All references to the actual instance must be deleted before this operation can be successfully performed. The function edmiDeleteInstanceReferences can be used to delete all references to an instance, or the references can be deleted one by one by the appropriate operations.
This operation is applicable only to application instances.
The data model that holds the actual application instance to delete must be open for write access before this function can be successfully performed.
The instanceID of the deleted instance will not be reused before the model that holds the actual instance is deleted.
Related functions: sdaiCreateInstance , sdaiCreateInstanceBN , edmiCreateScratchInstance , edmiCreateScratchInstanceBN
Header:
#include "sdai.h"
Prototype:
void sdaiDeleteInstance(sdaiAppInstance appInstance);
Arguments:

appInstance

A numeric instanceID that uniquely identifies the application instance to delete from the EDMdatabase.
The instanceID is defined and returned by the operation that creates the instance.

Returns:
Void – use sdaiErrorQuery to check for error in operation.
Example:
SdaiAppInstance appInstance;
SdaiModel model;
SdaiErrorCode errCode;
...
appInstance = sdaiCreateInstanceBN(model, "Point");
. . .
sdaiDeleteInstance(appInstance);
errCode = sdaiErrorQuery();
if (errCode) {
/* Error in operation */ 
printf("\nError: %s in sdaiDeleteInstance \n", 
edmiGetErrorText(errCode)); 
goto error; 
}
. . .