From OpenSCADAWiki
Jump to: navigation, search
Other languages:
Module Name Version License Source Languages Platforms Type Author Description
DBF DB DBF 2.2 GPL2 bd_DBF.so en,uk,ru,de x86,x86_64,ARM DB Roman Savochenko
  Maxim Lysenko, 2009 — the page translation
DB module. Provides support of the DBF files version 3.0.

The module provides to OpenSCADA support DB files of the DBF type. The module is based on the library for working with DBF software files "Complex2" of the firm NIIP "DIYA". The module allows you to perform actions on databases, tables and table contents.

1 Operations over the database

The operations of opening and closing of the database is supported, with the possibility of creating a new database when you open and delete existing at the close. In terms of the subsystem "DB" of OpenSCADA, opening of DB is its registration for further using of the program. It also supports the operation of requesting the list of tables in the database.

Under a DB, in the case of DBF files, is meant a directory containing DBF files. Therefore, database creation and removal operations create and delete folders where tables (DBF files) are stored. The role of the database address is the full name of the folder with DBF files. Access to the database is determined by the system permissions of the folder.

2 Operations over the table

Supports opening, closing tables, with the possibility of creating a new table when opening and removing an existing one when closed.

Actually, the DBF file is a table. Creating and deleting a table involves creating and deleting a DBF file. The table name represents the name of the DBF file in the database folder. The permissions of the table are determined by the rights to access the DBF file.

3 Operations over the table content

  • scanning of the table records;
  • requesting the values of specified records;
  • setting the values of specified records;
  • removing the records.

API of the subsystem "DB" suppose the access to the contents of the table on the value of key(s) fields. Thus, the operation of requesting of the record implies the preset of key columns of the object TConfig, which will do the request. Creating a new record (row) is performed by setting the record values that are missing.

The module allows you to dynamically change the structure of the database tables FireBird. So, in the case of inconsistency between the structure of the table and the structure of the record being set, the structure of the table will be brought to the desired structure of the record. In the case of requesting the record values and discrepancies between record structures and tables, only the values of the general entries of the record and the table will be obtained. The module does not track the order of the elements in the record and in the structure of the table!

When accessing table values, synchronization is used by capturing the resource to access the table. This prevents data corruption in the case of multithreaded access.

Types of elements of the DBF DB correspond to types of elements of OpenSCADA in the following way:

Types of OpenSCADA fields Types of fields of DB DBF
TFld::String "C"
TFld::Integer, TFld::Real "N"
TFld::Boolean "L"

4 Productivity of the DB

Measurement of the DB productivity were carried out by the test "DB" of the tests module "SystemTests", performing operations over the records of the structure: "name char (20), descr char (50), val double (10.2), id int (7), stat bool, reqKey string, reqVal string".

Operations for 1000 records, seconds K8-3000+,256M,120G Nokia N800, SD 2G Intel(R) Core(TM) i3 CPU 1.33GHz, 3G, HDD
Creating: 1.07 37 0.382
Updating: 1.6 33.8 0.368
Getting: 1.0 34.32 0.362
Seeking: - - 0.064
Seeking in preload: - - 0.064
Deleting: 0.95 37 0.371