|Author:||Roman Savochenko, Maxim Lysenko (2009)|
|Description:||DB module. It provides the support of *.dbf files, version 3.0.|
The module is designed to provide in the system OpenSCADA support of the type of database files *.dbf. The module is based on the library for work with dbf files for "Complex2" firm "DIYA" Ltd. The module allows you to perform operations on databases, tables and contents of tables.
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 system OpenSCADA opening of DB is its registration for further using of it in the system.
Under the DB, in the case of the dbf-files it is meant the directory containing the dbf-files. Therefore, operation of the creating and deleting of the database - creates and deletes the directory where the table (dbf-files) are stored. The role of the address of database plays the full name of the directory with dbf-files. Access to the database is defined by the system rights of access to the directory.
The module supports coding of data in the correct code page. To this purpose, for the database as a whole, you can specify a working code page. During the work it will be carried out data coding, database coding, from the DB code page to the system code page of OpenSCADA and backwards.
The operations of opening and closing of the table with the possibility of creating a new table when you open and deleting the existing one at the closing are supported.
Actually dbf-file is the table. Creation and deletion of tables implies creation and deletion of dbf-file. Table name is the name of dbf-file in the directory of DB. Access to the table are define by the rights of access to dbf-file.
API of subsystem “DB” suppose the access to the contents of the table on the value of key(s) fields. Thus, the operation of request of the record implies the preset of key columns of the object TConfig, which will fulfill the request. Creating a new record(string) is the installation of the values of record, which does not exist.
The module allows you to dynamically change the structure of the database tables DBF. Thus, in the event of a discrepancy of the table and the structure determined by record, the structure of the table will be reduced to the the required structure of record. In the case of the request of the value of the record, and mismatching of the structures of record and the table there will be available only to the values of common elements of the record and table. The module does not track the order of the elements in the record and in the structure of the table!
While access to the values of the tables the synchronization is used by through the capture of the resource to have access to the table. This avoids the destruction of data in the case of multi-access!
The types of the elements of dbf-file that correspond to types of elements of system OpenSCADA in the following way:
|The types of fields of system OpenSCADA||Type of field of dbf-file|
Measurement of productivity of DB were carried out by the test "DB" of the module of system tests "SystemTests", by 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>.
|Operation||K8-3000+,256M,120G||Nokia N800, SD 2G||Intel(R) Core(TM) i3 CPU 1.33GHz, 3G, HDD|
|Creation of the 1000 records (sec.):||1.07||37||0.382|
|Updating of the 1000 records (sec.):||1.6||33.8||0.368|
|Getting of the 1000 records (sec.):||1.0||34.32||0.362|
|Seeking of the 1000 records (sec.):||-||-||0.064|
|Seeking in preload of the 1000 records (sec.):||-||-||0.064|
|Deleting of the 1000 record (sec.):||0.95||37||0.371|