company logo

ObjectSpace :: asDatabase - Get object space as database

The function returns the ObjectSpace as Database, when the ObjectSpace is a Database. When the object space is not a database, the function throws an exception. In order to avoid exceptions, one may check the object space by calling isDatabase().

Database GetDatabase ( ObjectSpace &os ) {

  return os.isDatabase() ? os.asDatabase() : Database();

}

Return value:  Database handle ( odaba::Database & )

The database handle refers to an (usually) opened database. Calling functions with invalid database handles may cause an exception. For checking the database handle, isValid() can be called.

Implementation details

odaba::Database & ObjectSpace  :: asDatabase (  )