Exports the population of an edmModel located in a remote EDMdatabase to a local EDMdatabase. If the local edmModel exists, it may be overwritten or have its population incremented by that of the exported remote edmModel.
If the underlying Express Schema of the remote edmModel does not exist in the local EDMdatabase, it may optionally be downloaded from the remote EDMdatabase.
Related functions: edmiRemoteImportModel.
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteExportModel(SdaiServerContext serverContextId,
SdaiString remoteRepositoryName,
SdaiString remoteModelName,
SdaiString localRepositoryName,
SdaiString localModelName,
SdaiString diagnosticFile,
SdaiString schemaName,
SdaiUnsignedInt options,
SdaiInteger *nWarnings,
SdaiInteger *nErrors,
EdmiError *sdaiError);
Arguments:
serverContextId |
Context identification, from edmiDefineServerContext |
remoteRepositoryName |
The name of the edmRepository in the remote _EDMdatabase_ that contains the edmModel to export into the local _EDMdatabase{_}. Repository names are case sensitive. |
remoteModelName |
The name of the edmModel in the remote _EDMdatabase_ to to export into the local _EDMdatabase{_}. Model names are case sensitive. |
localRepositoryName |
The name of the edmRepository in the local _EDMdatabase_ that contains or that shall eventually contain the edmModel specified by the argument <localModelName>. Repository names are case sensitive. |
localModelName |
The name of the edmModel to create, update or overwrite in the local _EDMdatabase_ . Model names are case sensitive. |
diagnosticFile |
Specifies the name of the file that shall receive the diagnostic information generated by this function. If this argument is NULL, all diagnostic information will be written to the _EDMinterface_ current output device. The _EDMinterface_ current output device can be defined by the edmiDefineOutputFunction operation. |
schemaName |
The name of the Express Schema in the local _EDMdatabase_ to be used as base for the exported data. If this Express Schema does not exist in the local _EDMdatabase, it may be automatically downloaded by using one of the options_ DOWNLOADING_SCHEMA_IF_REQUIRED or DOWNLOADING_SCHEMA |
options |
See list of available options below. |
nWarnings |
Variable that will receive the number of warnings resulting from the exporting of the edmModel |
nErrors |
Variable that will receive the number of errors resulting from the exporting of the edmModel |
sdaiError |
Variable that will receive any _EDMinterface_ error code resulting from the exported data it self. System errors in general wil not be returned in this variable. |
Options: Descriptions:
DELETING_EXISTING_MODEL |
If the edmModel that is specified by the argument <localModelName> already exists it will be deleted and recreated before the remote edmModel is imported. |
DELETE_INSTANCES_WITH_REFS |
If an edmModel is implicitely created, this option will disable one of the models built in features, thereby improving its data manipulation performance. |
DELETE_INSTANCE_REFS_ON_DELETE |
If an edmModel is implicitely created, this option will disable one of the models built in features, thereby improving its data manipulation performance. |
UNPACKED_MODEL |
No garbage collection for the edmModel when data is freed on data deletion or data change. The disk space used for the actual edmModel will normally increase. |
USER_CONTROLLED_INVERSE |
If an edmModel is implicitely created, this option will disable one of the models built in features, thereby improving its data manipulation performance. |
NO_INSTANCE_REFERENCES |
If an edmModel is implicitely created, this option will disable one of the models built in features, thereby improving its data manipulation performance. |
LOG_TO_STDOUT |
Any logged information will be written to the _EDMinterface_ current output device. The _EDMinterface_ current output device can be defined by the edmiDefineOutputFunction operation. |
ADD_TO_EXISTING_MODEL |
The population of the exported remote edmModel will be added to the population of the existing local edmModel. The exported data must be based on the same underlying Express Schema as that of the existing edmModel. |
LOG_TO_FILE |
Any logged information will be stored in the file specified by the <diagnosticFile> argument. |
DELETING_EXISTING_SCHEMA |
If the option DOWNLOADING_SCHEMA is used and the Express Schema already exists in the local EDMdatabase, the local Express Schema will be overwritten by that used for the remote edmModel. |
DOWNLOADING_SCHEMA |
The Express Schema used for the edmModel in the remote EDMdatabase, will be downloaded to the local EDMdatabase. Use the option DELETING_EXISTING_SCHEMAS if you want to overwrite an existing local version of the Express Schema. |
DOWNLOADING_SCHEMA_IF_REQUIRED |
The Express Schema used for the edmModel in the remote EDMdatabase, will be downloaded to the local _EDMdatabase_ , but only if it does not already exist. |
LOG_ERRORS_AND_WARNINGS_ONLY |
Limits the logging to include nothing but the instances that generate errors or warnings. |
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, error;
SdaiInteger nWrn, nErr;
SdaiServerContext myContext;
SdaiModel modelId;
SdaiInstance instId;
SdaiOptions options;
SdaiRepository repId = sdaiOpenRepositoryBN("MyRepository");
/* Create Server Context */
rstat = edmiDefineServerContext("MyContext",
"Johnny", "Supervisor", "cf37ftr",
"TCP", "9090", "MyServerHost",
NULL, NULL, NULL, NULL, NULL, &myContext);
/* Export the model from the remote database */
options = LOG_TO_FILE;
options |= DELETING_EXISTING_MODEL;
rstat = edmiRemoteExportModel(myContext,
"DataRepository", "Friends",
"MyRepository", "MyFriends",
"c:/tmp/friends.export.diagnostics",
"FRIENDS_SCHEMA", options,
&nWrn, &nErr, &error);
/* Work locally */
modelId = sdaiOpenModelBN(repId, "MyFriends", sdaiRW);
instId = edmiCreateInstanceAndPutAttrsBN(modelId, "FRIEND", 2,
"FIRST_NAME", sdaiSTRING, "Lucy",
"LAST_NAME", sdaiSTRING, "Schmidt");
/* Import the model into the remote database */
options = LOG_TO_FILE;
options |= DELETING_EXISTING_MODEL;
rstat = edmiRemoteImportModel(myContext,
"DataRepository", "Friends",
"MyRepository", "MyFriends",
"c:/tmp/friends.import.diagnostics",
"FRIENDS_SCHEMA", options,
&nWrn, &nErr, &error, NULL);
. . .