company logo

Application :: sharedDatabase - Shared database property

When the feature is enabled (true), database files are opened only once, independent on the number of database handles opened for a database file.

When shared database is enabled and the database is opened exclusively, shared database does not call file locks in order to prevent database resources from parallel usage. Shared database is typically used for server applications. When enabling shared database, database resources are locked internally. When a database is opened with shared access (NET=YES), file locks are submitted in addition in order to prevent different processes from improperly updates of database resources.

Enabling shared database may also increase performance, since database resources can be cached. The cache size is controlled by the CACHE.SIZE option. The feature might be also activated by setting the CACHE option (e.g. in a configuration or ini-file).

Return value:  Success ( bool  )

The value is true when the function was executed successfully. Otherwise the value is set to false.

Implementation overview

Implementation details

  1. Shared database property
    bool Application  :: sharedDatabase (  )

    The function can be called in order to share databases between threads and database handles. When the feature is enabled, database files are opened only once, independent on the number of database handles opened for a database file.

    When shared database is enabled and the database is opened exclusively, shared database does not call file locks in order to prevent database resources from parallel usage. Shared database is typically used for server applications. When enabling shared database, database resources are locked internally. When a database is opened with shared access (NET=YES), file locks are submitted in addition in order to prevent different processes from improperly updates of database resources.

    Enabling shared database may also increase performance, since database resources can be cached. The cache size is controlled by the CACHE.SIZE option.

  2. to list
  3. Activate shared database feature
    bool Application  :: sharedDatabase ( bool bEnable )

    The function can be called in order to share databases between threads and database handles. The feature has to be enabled before opening databases. Only databases opened after activating the option will be shared. The option cannot be reset as long as at least one shared database is still opened.

    • bEnable - Enable resource

      In order to enable the referenced resource true should be passed. Passing false will disable the resource.

  4. to list