company logo

ObjectSpace - Database Object Handle

Object space handles are necessary for accessing data in an object space. An object space can be considered as a database within a database. Each database has got a root object space on top. Below each object space any number of subordinated object spaces can be created.

Object spaces in a database are logically separated but not physically. Thus, it becomes possible to establish links between database instances in different object spaces. Each object space has got, however, its own extents containing the global instances of the object space.

The object space handle for the root object space is part of the database handle (-> Database ) and need not to be opened explicitly.

A object space handle is required for opening extent property handles for accessing instances stored in extents of an object space.

The object space handle administrates transactions. Transactions can be started and stopped for each object space handle. The object space handle is not thread-save, i.e. object space handles cannot be used simultaneously in different threads.

The object space supports version slices, i.e. each object space may have its own current object space version.

Opening object space

In order to access an object space, it has to be created (constructor) and opened ( open() ). After being opened, an access object has been created for the object space handle. When calling the copy constructor, the new object space handle is referring to the same access object and need not to be opened again.

The are different ways of providing an object space handle. Since each database is a root object space, each database handle ( Database ) provides an object space handle ( ObjectSpace ). Moreover, an object space handle might be opened directly for a data source defined in a configuration file or data catalog.

In order to open subordinated object spaces in an object space hierarchy, one may open the subordinated object space by name (when a name has been assigned while creating the object space) or by object identity. The preferred way is referring to named objects. Names for subordinated object spaces have to be unique within the parent object space, only.

// fragment

  // open root object space for sample database

  ObjectSpace  os;

  os.Open(mainClient(),"Sample",write,automatic);

  // create subordinated object space SubSample

  ObjectSpace  subOs;

  subOs.Open(os,"SubSample",write,0,automatic);

Attributes
Function Groups
Functions