sdaiCreateInstanceBN


Create a new entity instance of the specified instance type in the specified model in the EDMdatabase.
All the attributes of the created instance are initially unset, i.e., the attribute values are indeterminate. The sdaiTestAttr and sdaiTestAttrBN functions will return sdaiFALSE for all attributes of the created instance until the attribute values have been set with one of the functions: sdaiPutAttr , sdaiPutAttrBN , sdaiPutAttrs , sdaiPutAttrsBN , sdaiCreateAggr , sdaiCreateAggrBN .
A numeric instanceID that uniquely identifies the entity instance in an EDMdatabase will be the returned function value. This instanceID should be used to identify this particular instance in subsequent EDMinterface operations. An instanceID is persistent and fixed, i.e. it is constant throughout the lifetime of the actual instance.
An instanceID will not be reused before the actual model that holds the particular instance identified by this instanceID is deleted.
This function is applicable only to data models.
The model that holds the created instance must be open for write access before this function can be successfully performed.
Related function: sdaiCreateInstance, edmiCreateScratchInstance , edmiCreateScratchInstanceBN , sdaiDeleteInstance
 
Header:
#include "sdai.h"
Prototype:
SdaiAppInstance sdaiCreateInstanceBN(SdaiModel    model,
                                      SdaiString   entityName); 
Arguments:

model

A numeric modelID that uniquely identifies a model in the EDMdatabase. The actual model must be a data model that is currently open for write access .
The modelID is returned from the functions: sdaiCreateModel , sdaiCreateModelBN , sdaiOpenModelBN , edmiGetModel , edmiGetModelBN , sdaiGetInstanceModel

entityName

Name of the ENTITY that defines the instance type to create. ENTITY names are case insensitive. The ENTITY must be defined in the schema that is the underlying schema of the model specified by the <model> argument.

Returns:
A numeric instanceID that uniquely identifies the new created entity instance in the EDMdatabase. This instanceID should be used to identify the particular instance for subsequent EDMinterface operations.
instanceID != 0 : operation successfully performed.
instanceID = 0 : operation failed, use sdaiErrorQuery function to get error reason.
Example:
SdaiAppInstance currInst;
SdaiModel model;
...
currInst = sdaiCreateInstanceBN(model, "Point");
if (! currInst) {
/* Error in operation */ 
printf("\nError: %s in sdaiCreateInstanceBN \n", 
edmiGetErrorText(sdaiErrorQuery())); 
goto error; 
}
. . .