company logo

Database :: Database - Opening a database handle

The function allows creating a database handle, which is either an empty database handle or a copy for the database handle passed to the function.

Implementation overview

Implementation details

  1. Open database handle copy
    Database  :: Database ( odaba::Database &cDatabase )

    This function creates a copy of the database handle passed in cDatabase. Both, the copy and the origin are referring to the same access object. The access object will be closed when closing the last database handle referring to it, regardless on the sequence the handles have been opened.

    Handle copies for the same database access object must not be used in different threads. In order to provide thread-save database access, object space access copies should be used.

    If cDatabase is not opened, the calling database handle will be closed.

    • cDatabase - Database handle

      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.

  2. to list
  3. Create empty database handle
    Database  :: Database (  )

    The function creates an empty database handle. A database can be opened later with this handle calling open(). The constructor will not open new database handles, i.e. in order to open a database handle, the open() function need to be called explicitly.

    Empty database handles are not valid and may cause exceptions when calling Database functions.

      Database      dbh;

      dbh.open(dict,"c:/odaba/Sample/Sample.dat");

  4. to list