<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html class="client-nojs" dir="ltr" lang="en">
<head>
<meta charset="UTF-8" />
<title>Modules/DBF - OpenSCADAWiki</title>
<meta content="MediaWiki 1.26.4" name="generator" />
<link href="https://www.gnu.org/copyleft/fdl.html" rel="copyright" />
<link href="../files/doc.css" rel="stylesheet" /></head>
<body><div class="floatright"><a href="../index.html"><img alt="OpenSCADA" src="../../en/files/index.png" /></a></div><div id="mw_header">
			<div class="mw-indicators">
</div>
			<h1 id="firstHeading" lang="en">Modules/DBF</h1>
		</div><div class="mw-content-ltr" dir="ltr" id="mw-content-text" lang="en"><div class="mw-pt-languages" dir="ltr" lang="en"><div class="mw-pt-languages-list autonym"><span class="mw-pt-languages-ui mw-pt-languages-selected mw-pt-progress mw-pt-progress--complete">English</span>&nbsp;• ‎<a class="mw-pt-progress mw-pt-progress--complete" href="../../ru/Modules/DBF.html" title="Модули/DBF (100% translated)">mRussian</a>&nbsp;• ‎<a class="mw-pt-progress mw-pt-progress--complete" href="../../uk/Modules/DBF.html" title="Модулі/DBF (100% translated)">Українська</a></div></div>
<table class="wikitable">

<tr>
<th> Module </th>
<th> Name </th>
<th> Version </th>
<th> License </th>
<th> Source </th>
<th> Languages </th>
<th> Platforms </th>
<th> Type </th>
<th> Author </th>
<th> Description
</th></tr>

<tr>
<td> <a href="../Modules/DBF.html" title="Special:MyLanguage/Modules/DBF">DBF</a> </td>
<td> DB DBF
<ul><li> <b><a href="../Program_manual.html#DBFeat" title="Special:MyLanguage/Documents/Program manual">Features</a>:</b> LIST, GET, SEEK, SET, DEL, FIX</li></ul>
</td>
<td> 2.4 </td>
<td> GPL2 </td>
<td> bd_DBF.so </td>
<td> en,uk,ru,de </td>
<td> x86,x86_64,ARM
</td>
<td> DB </td>
<td> Roman Savochenko<br />&nbsp;&nbsp;<font size="-2"><i>Maxim Lysenko, 2009 — the page initial translation</i></font> </td>
<td> DB module. Provides support of the DBF files version 3.0.
</td></tr></table>
<p>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.
</p>
<div class="toc" id="toc"><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#Operations_over_the_database"><span class="tocnumber">1</span> <span class="toctext">Operations over the database</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Operations_over_the_table"><span class="tocnumber">2</span> <span class="toctext">Operations over the table</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="#Operations_over_the_table_content"><span class="tocnumber">3</span> <span class="toctext">Operations over the table content</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="#Productivity_of_the_DB"><span class="tocnumber">4</span> <span class="toctext">Productivity of the DB</span></a></li>
</ul>
</div>

<h2><span class="mw-headline" id="Operations_over_the_database"><span class="mw-headline-number">1</span> Operations over the database</span></h2>
<p>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.
</p><p>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.
</p>
<h2><span class="mw-headline" id="Operations_over_the_table"><span class="mw-headline-number">2</span> Operations over the table</span></h2>
<p>Supports opening, closing tables, with the possibility of creating a new table when opening and removing an existing one when closed.
</p><p>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.
</p>
<h2><span class="mw-headline" id="Operations_over_the_table_content"><span class="mw-headline-number">3</span> Operations over the table content</span></h2>
<ul><li> scanning of the table records;</li>
<li> requesting the values of specified records;</li>
<li> setting the values of specified records;</li>
<li> removing the records.</li></ul>
<p>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.
</p><p>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!
</p><p>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.
</p><p>Types of elements of the DBF DB correspond to types of elements of OpenSCADA in the following way:
</p>
<table class="wikitable">

<tr>
<th> Types of OpenSCADA fields </th>
<th> Types of fields of DB DBF
</th></tr>
<tr>
<td> TFld::String </td>
<td> "C"
</td></tr>
<tr>
<td> TFld::Integer, TFld::Real </td>
<td> "N"
</td></tr>
<tr>
<td> TFld::Boolean </td>
<td> "L"
</td></tr></table>
<h2><span class="mw-headline" id="Productivity_of_the_DB"><span class="mw-headline-number">4</span> Productivity of the DB</span></h2>
<p>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: "<b>name char (20), descr char (50), val double (10.2), id int (7), stat bool, reqKey string, reqVal string</b>".
</p>
<table class="wikitable">

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






</div><table style="border-top: dotted 2px #999999; margin-top: 20pt; color: gray;" width="100%"><tr><td style="text-align: left;" width="40%"><a href="http://oscada.org/wiki/Modules/DBF/en">Modules/DBF/en</a> - <a href="http://oscada.org/en/main/about-the-project/licenses/">GFDL</a></td><td style="text-align: center;">April 2025</td><td style="text-align: right;" width="40%">OpenSCADA 1+r3018</td></tr></table></body>
</html>