edmiCreateModel
SdaiModel edmiCreateModel(SdaiRepository repository, SdaiString modelName, SdaiSchema schema, SdaiInteger options);
Creates a new model in the specified repository in the EDMdatabase. A model is a logical container for entity instances defined by one Express schema. This schema will be the underlying schema of the new model and this particular schema must exist as a dictionary model in the EDMdatabase before this function can be successfully performed. Only data models can be created by this function. Any number of models of the same Express schema can exist in an EDMdatabase. This operation is similar to the sdaiCreateModel operation except that this operation can specify additional attributes for the created model. These model attributes can influence the system performance. The new model will be closed after creation, hence one of the functions sdaiOpenModel or sdaiOpenModelBN must be performed on the model before any access to it is permitted. A numeric modelID that uniquely identifies the created model in the EDMdatabase is returned. This modelID should be used in subsequent EDMinterface operations to identify the actual model. The model name qualified with the related repository name will also uniquely identify a model in an EDMdatabase. The executing EDMuser will be the owner of the new model and the current EDMgroup account of the executing EDMuser will be the owner group of the model. The owner and owner group of a model is relevant for access rights to the model in subsequent sdaiOpenModel and sdaiOpenModelBN operations. The model protection will be set according to the default model protection of the executing EDMuser. The repository that will hold the new model must be open before this function can be successfully performed.
Arguments
Type | Name | Comment |
SdaiRepository | repository | A numeric repositoryID that uniquely identifies the repository in the EDMdatabase that will hold the new model. This repository must be open. The repositoryID is returned by the sdaiOpenRepository and sdaiOpenRepositoryBN functions. |
SdaiString | modelName | Specify the name of the new model. A model name must start with a letter and the rest of the model name can optionally be any mix of any alphanumeric character and the underscore character. Model names are case sensitive. A model name must be unique within the repository that holds the model. |
SdaiSchema | schema | A numeric schemaID that uniquely identifies an EXPRESS schema in an EDMdatabase that will be the underlying schema of the new model. This schema defines all possible instance types that can be created in the actual model. This particular EXPRESS schema must exist as a dictionary model in the EDMdatabase before this operation can be successfully performed. The schemaID identifier is returned by the edmiGetSchema function. |
SdaiInteger | options | Specifies the current options, i.e., the model attributes. The <options> value should be defined as a bitwise OR between the options to enable. All the option names are defined in the header file sdai.h . Default options are enabled when the value of <options> is set to zero. |
Return Value
Type | Comment |
SdaiModel | Â |
Â
Options
 Â
1 | Option | Comment |
2 | M_USER_CONTROLLED_INVERSE | No automatic update and maintenance of INVERSE attributes in the actual model |
3 | M_INSTANCE_REFERENCES | The system will keep track of all references to an instance in the model. |
4 | M_DELETE_INSTANCE_REFS_ON_DELETE | All references to an instance will implicitly be deleted when the instance is deleted. |
5 | M_INSTANCE_REFS_MUST_BE_DELETED | An instance cannot be deleted as long as the instance is referenced by another instance. |
6 | M_PACKED_MODEL | No garbage collection for model when data is freed on data deletion or data change operation. |
7 | USE_DEFAULT_OPTIONS | Â |
8 | M_INSTANCES_HASH_TABLE | Â |
9 | INSTANCES_HASH_TABLE | same as M_INSTANCES_HASH_TABLE, used to mark that modelInstanceHashTable is defined by edmiHashModelInstances function |
10 | M_IGNORE_PERSISTENT_ATTR_HASH_TABLE | Â |
11 | Â IGNORE_PERSISTENT_ATTR_HASH_TABLE | Â M_IGNORE_PERSISTENT_ATTR_HASH_TABLE |
12 | CHAR_ENCODING_UTF_8 | Â |
13 | CHAR_ENCODING_UTF_16 | Â |
14 | CHAR_ENCODING_ISO_10646_UCS_2 | Â |
15 | CHAR_ENCODING_ISO_10646_UCS_4 | Â |
16 | CHAR_ENCODING_ISO_LATIN_1 | Â |
17 | CHAR_ENCODING_ISO_LATIN_2 | Â |
18 | CHAR_ENCODING_ISO_8859_3 | Â |
19 | CHAR_ENCODING_ISO_8859_4 | Â |
20 | CHAR_ENCODING_ISO_8859_5 | Â |
21 | CHAR_ENCODING_ISO_8859_6 | Â |
22 | CHAR_ENCODING_ISO_8859_7 | Â |
23 | CHAR_ENCODING_ISO_8859_8 | Â |
24 | CHAR_ENCODING_ISO_8859_9 | Â |
25 | CHAR_ENCODING_ISO_2022_JP | Â |
26 | CHAR_ENCODING_SHIFT_JIS | Â |
27 | CHAR_ENCODING_EUC_JP | Â |
Â
Example
Â
 SdaiModel model; SdaiSchema schema; SdaiRepository repository; ... model = edmiCreateModel (repository, "MyNewModel", schema, M_PACKED_MODEL); if (! model) { /* Error in operation */ printf("\nError in edmiCreateModel: %s\n", edmiGetErrorText(sdaiErrorQuery())); goto error; } ...
Â
See also
Filter by label
There are no items with the selected labels at this time.
Â