This function has two areas of application;
- Opens a repository within a locally connected database. This feature has implemented to provide all EDMInterface functionality through the remote EDMInterface calls. Only applicaple for the LOCAL_CONTEXT communication type. See example 1.
- Opens a repository within one or optionally all the EDMapplicationServer processes used by the EDMserver. This is a password protected feature ment for system administrators only. See example 2.
The application server processes of an EDMserver needs to load and maintain local copies of some of the database files. If these files are big, the handling of them may be time consuming. Therefore, the superuser may use this function to open repositories from one or more application server processes, thereby reducing the delay for the first user that requires access.
An EDMapplicationServer is a process that implements the remote EDMInterface operations invoked by the EDMclients. An EDMserver may have from one to any number of EDMapplicationServer processes. In most cases the EDMdatabaseServer and the EDMapplicationServers constitute the EDMserver. This is denoted an EDMserverRoom.
Except for the communication type LOCAL_CONTEXT, all remote EDMInterface operations are stateless.
Related function: edmiRemoteCloseRepository
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteOpenRepository(SdaiServerContext serverContextId,
SdaiString remoteRepositoryName,
SdaiAccessMode openMode,
SdaiString superUserPassword,
SdaiClientId clientId,
SdaiOptions options,
SdaiRepository *repositoryId,
SdaiInvocationId *edmiInvocationId);
Arguments:
serverContextId |
Context identification, from edmiDefineServerContext |
remoteRepositoryName |
The name of the repository to be opened in the remote _EDMdatabase{_}. Repository names are case sensitive. |
openMode |
Legal access modes are sdaiRO and sdaiRW. |
superUserPassword |
The password for the superuser within the remote database. This argument is not required when the server context specifies communication type LOCAL_CONTEXT. |
clientId |
The client Id of the Main Client connection of the EDMapplicationServer for which the repository shall be opened. See the example. |
options |
See description of available options below. |
repositoryId |
A variable that will receive the repositoryID that uniquely identifies the opened repository in the remote EDMdatabase. |
edmiInvocationId |
Currently not used. |
Options: Descriptions:
ALL_SERVERS |
Open the repository from all the EDMapplicationServer processes in the EDMserverRoom. |
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:
/* Open selected repositories and models
to initialize a remote database */
int i;
EdmiError rstat;
SdaiServerContext suContext;
SdaiRepository repositoryId;
SdaiModel modelId;
SdaiQueryResult qexRes;
SdaiInteger nRepository, nModel;
SdaiInteger index;
/* Define Remote Server Context
for the superuser */
rstat = edmiDefineServerContext("SuperUserContext",
"superuser", NULL, "xfx56kl9",
"TCP", "9090", "MyServerHost",
NULL, NULL, NULL, NULL, NULL, &suContext);
/* Find and open all repositories in the
database that is not the 'SystemRepository',
'DictionaryRepository' or
'EDMvisualExpress' repository */
index = 0;
rstat = edmiRemoteSelectInstances(suContext, "SystemRepository",
"ExpressDataManager", "EDM_REPOSITORY",
"(NAME <> 'SystemRepository') AND \
(NAME <> 'DictionaryRepository') AND \
(NAME <> 'EDMvisualExpress')", 0, "NAME", NULL,
NULL, &index, &nRepository, &qexRes,
NULL, NULL, NULL, NULL);
for (i=0;i<nRepository;i++) {
rstat = edmiRemoteOpenRepository(suContext,
((SdaiString *) qexRes->columnDescr[0]->pvalue)[i],
sdaiRW, "xfx56kl9", 0, ALL_SERVERS,
&repositoryId, NULL);
}
edmiFreeQueryResult(qexRes);
/* Find and open all models in the database
that is not in the 'SystemRepository',
'DictionaryRepository' or
'EDMvisualExpress' repository */
index = 0;
rstat = edmiRemoteSelectInstances(suContext, "SystemRepository",
"ExpressDataManager", "EDM_MODEL",
"(REPOSITORY.NAME <> 'SystemRepository') AND \
(REPOSITORY.NAME <> 'DictionaryRepository') AND \
(REPOSITORY.NAME <> 'EDMvisualExpress')", 0,
"REPOSITORY.NAME NAME", NULL,
NULL, &index, &nModel, &qexRes,
NULL, NULL, NULL, NULL);
for (i=0;i<nModel;i++) {
rstat = edmiRemoteOpenModel(suContext,
((SdaiString *) qexRes->columnDescr[0]->pvalue)[i],
((SdaiString *) qexRes->columnDescr[1]->pvalue)[i],
sdaiRW, "xfx56kl9", 0, 0, &modelId, NULL);
}
edmiFreeQueryResult(qexRes);
. . .