edmiRemoteConnect
Â
Â
EdmiError edmiRemoteConnect(SdaiServerContext serverContextId, SdaiString edmUserName, SdaiString edmUserGroup, SdaiString password, SdaiString *unavailableMessage, SdaiInvocationId *edmiInvocationId);
Connects an EDMclient application process to a local EDMdatabase. This feature has implemented to provide all EDMInterface functionality through the remote EDMInterface calls. The EDMclient will be connected to the EDMserver with an EDMuser account and an optional EDMgroup account. This function is applicable for the LOCAL_CONTEXT communication type.
Arguments
Type | Name | Comment |
 SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
 SdaiString | edmUserName | Name of an EDMuser account in the _EDMdatabase. EDMuser account names are case insensitive. |
 SdaiString | edmUserGroup | Name of an EDMgroup account in the _EDMdatabase This argument is optional. If it is not used, no check on "group access rights" will be performed within the connect session. Any protected database object that is being created when connected without an EDMgroup account will not be assigned a "group owner". The EDMuser specified by the <edmUserName> argument must be a member of the EDMgroup defined by the <edmUserGroup> argument. |
 SdaiString | password | The password for the EDMuser specified by the <edmUserName> argument. |
 SdaiString | unavailableMessage | A variable that will receive an optional message from the system administrator if the connect operation fails due to the EDMdatabase having been set unavailable for maintenance reasons. The text string is located in a temporary internal buffer and will be overwritten by the next EDMinterface call. Do not free this memory with edmiFree |
 SdaiInvocationId | edmiInvocationId | Currently not used. |
Return Value
Â
Options
 Â
Â
Example
Â
 EdmiError rstat; SdaiSession sessionId; SdaiServerContext myLocalContext; SdaiRepository repId; SdaiModel modId; SdaiAggr aggrId; SdaiInteger nInst; SdaiString unavailMsg; /* Define Remote Server Context */ rstat = edmiDefineServerContext("MyLocalContext", NULL, NULL, NULL, "LOCAL_CONTEXT", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &myLocalContext); /* Connect to a local database. This operation will connect the EDMthick client to the EDMserver. It will fail if the server has no more available named users. After the connect, the client may be identified on the server by edmiRemoteWhoIsOn() */ rstat = edmiRemoteConnect(myLocalContext, "Johnny", "Supervisor", "cf37ftr", &unavailMsg, NULL); /* Open a session in the local database */ rstat = edmiRemoteOpenSession(myLocalContext, &sessionId, NULL); /* Open the 'MyRepository' repository */ rstat = edmiRemoteOpenRepository(myLocalContext, "MyRepository", sdaiRW, NULL, 0, 0, &repId, NULL); /* Open the 'MyModel' model. This loads a copy of the model to the local file system. */ rstat = edmiRemoteOpenModel(myLocalContext, "MyRepository", "MyModel", sdaiRW, NULL, 0, 0, &modId, NULL); . . . /* The local copy of 'MyModel' is loaded when the model is opened. It remains unchanged until a transaction is started. Then the local copy will be syncronized with the EDMserver to include any changes made by other users in the meantime */ rstat = edmiStartTransaction(); /* Count the current number of instances of type MyEntity in MyModel */ rstat = edmiRemoteGetEntityExtentBN(myLocalContext, "MyRepository", "MyModel", "MyEntity", 0, &aggrId, &nInst, NULL, NULL); printf("\n%d instances of MyEntity in MyModel.", nInst); /* Terminate the transaction */ rstat = edmiAbortTransaction(); /* Close the model. Some operations may not be performed on the model by other users for as long as it is opened by this client. */ rstat = edmiRemoteCloseModel(myLocalContext, "MyRepository", "MyModel", NULL, 0, 0, NULL); . . . /* Close the repository. This would implicitely have closed the model as well. Some operations may not be performed on the repository by other users for as long as it is opened by this client. */ rstat = edmiRemoteCloseRepository(myLocalContext, "MyRepository", NULL, 0, 0, NULL); . . . /* Close the session. This will implicitely close all open models and repositories. */ rstat = edmiRemoteCloseSession(myLocalContext, NULL); /* Disconnect. The occupied named user on the EDMserver will be released. */ rstat = edmiRemoteDisconnect(myLocalContext, NULL); . . .
Â
See also
Filter by label
There are no items with the selected labels at this time.
Â
Â