company logo

DatabaseHandle :: DatabaseHandle - Constructor

A database can be opened in local, in client/server mode or in file server mode. Local mode usually implies exclusive access. When running several applications on a local machine the database should be opened in file server mode to provide concurrent access to the database. Client/server mode is suggested when running the database from different clients on a central server.

Return value:  Success ( logical  )

Implementation details

  1. Copy constructor
    logical DatabaseHandle  :: DatabaseHandle ( DatabaseHandle &dbhandle_refc )

    This constructor creates a copy of the database handle. Both, the copy and the origin are referring to the same resources. The database handle is closed when closing the last database handle instance for a database, regardless on the sequence the handles have been opened.

    • dbhandle_refc - Reference to database handle
  2. to list
  3. Create database handle
    logical DatabaseHandle  :: DatabaseHandle ( DictionaryHandle &dicthdl_refc, NPath &cpath, PIACC accopt, logical w_netopt, NString &key_buffer=NString::Null(), logical online_version=NO, ::ResourceTypes local_ressources=RES_automatic, char sysenv=NO, uint16 schema_version_w=CUR_VERSION, RootBase_Types rb_type=RBT_ODABA )

    The function creates a database handle for an opened dictionary. The database path (cpath) passed to the function may contain system variable references that are resolved before opening the database.

    The database can be opened in read or write mode (accept). When running the database in file server mode the net option defines whether the database is running exclusive or can be shared by other users. The local_resources parameter defines the way the database is opened.

    For opening an older version for the database one may pass a version number in version_nr.

    • dicthdl_refc - - internal feature (not documented)
    • cpath - Complete file or directory path
    • accopt - Access mode
    • w_netopt - Multi-user option

      Passing this value as true (YES) indicates that multi-user access is requested. False (NO) indicates exclusive use of database. Accessing a database in update or write mode, NO guarantees absolute exclusive access.

    • key_buffer - - internal feature (not documented) Default: NString::Null()
    • online_version - Online versioning option

      When this option is set the database will be enabled for on line versioning. When the option is set to NO the system variable ONLINE_VERSION is checked instead.

      Default: NO
    • local_ressources - Resource type

      Depending on the resource type the database or dictionary is opened on the client or server side.

      Default: RES_automatic
    • sysenv - System application

      This option indicates that the application is running as system application. In this case context functions are disabled and will not be executed. This option should never be set in normal applications because this may lead to logical inconsistency of the database.

      When running a replication client, this option contains the value 2. Running a replication client in a system application, the option contains the value 3.

      For maintenance purposes, 4 might be passed in the variable. In this case, versions will not be upgraded automatically.

      Default: NO
    • schema_version_w - Scheme version

      Schema versions are numbered consecutively beginning with 0. In order to refer to the current schema version, the version value may be set to -1.

      Default: CUR_VERSION
    • rb_type - - internal feature (not documented) Default: RBT_ODABA
  4. to list
  5. Create database handle from dictionary handle
    logical DatabaseHandle  :: DatabaseHandle ( DictionaryHandle &dicthdl_refc, PIACC accopt )

    The function creates a database handle from the dictionary handle.

    • dicthdl_refc - - internal feature (not documented)
    • accopt - Access mode
  6. to list
  7. Empty database handle
    logical DatabaseHandle  :: DatabaseHandle (  )

    The constructor creates an empty database handle. A database can be opened later with this handle using the Open() function.

  8. to list
  9. Create new database
    logical DatabaseHandle  :: DatabaseHandle ( NPath &cpath, int64 dasize=0, logical pindep=NO )

    This function allows creating a new database. Usually creating a database explicitly is not necessary. When, however, special options as lowest and highest local identifiers (LOID) are to be passed this constructor can be used.

    • cpath - Complete file or directory path
    • dasize - Size for data area

      When no data area size had been defined (0), the data area expands whenever more space is needed.

      The maximum size for data areas in a 32-bit versions is 4,026,531,840 (0xF0000000) bytes or nearly 4GB. For 64-bit versions, the maximum size is 281,474,976,710,656 or 256 TB.

      Default: 0
    • pindep - Platform independence option

      The platform independence option indicates that integer numbers are to be stored in platform independent format. This information is stored in the database header after creating the database.

      Default: NO
  10. to list