company logo

Accessing databases with same dictionary

When accessing data in another database referring to the same dictionary, the database external database must be opened. Typed variable declarations referring to the external database are allowed, as long as the external database is based on the same dictionary as being defined in the data source.

Once, an external property has been opened, it can bypassed as parameter to other expressions, since properties know the database, to which they are connected.

DATASOURCE=MyProject;

void SDB_ResourceRef::CopyResourceRef(set<SDB_ResourceRef> &oresref) {

VARIABLES

string     number;

PROCESS

if ( oresref.description.get(0).Exist ) {

description.provide(0);

number = description.__AUTOIDENT;

description.copy(oresref.description,number,ReplaceOptions::ReplaceLocal);

}

};

void ODC_ImpClass::CopyResourceRef(set<ODC_ImpClass> &oresource) {

if ( oresource.resource_ref.get(0).Exist )

resource_ref.provide(0).CopyResourceRef(oresource.resource_ref);

};

void main() {

VARIABLES

Dictionary          dict;

Database            db;

set<ODC_ImpClass>  &iclasses = ODC_ImpClass;

set<ODC_ImpClass>   oclasses;

PROCESS

  dict.open("l:/odaba/adk.sys","PI_Read",true); // same as dictionary in data source for MyProject

  db.open(dict,"l:/YourProject/project.dev","PI_Read",true);

  oclasses.open(opa_db,"ODC_ImpClass","PI_Read");

  oclasses.get('YourClass');

  iclasses.get('MyClass');

  iclasses.CopyDocumentation(oclasses); // copies documentation from YourProject class YourClass

oclasses.close;

db.close();

dict.close();

};