ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/doc/readme.localdatabase.xhtml
(Generate patch)

Comparing ibx/trunk/doc/readme.localdatabase.xhtml (file contents):
Revision 40 by tony, Mon Feb 15 14:44:25 2016 UTC vs.
Revision 41 by tony, Sat Jul 16 12:25:48 2016 UTC

# Line 57 | Line 57
57          .P49 { font-size:130%; font-weight:bold; margin-bottom:0.0835in; margin-top:0.1665in; font-family:Liberation Sans; writing-mode:page; line-height:100%; }
58          .P5 { font-size:12pt; line-height:100%; margin-bottom:0.0972in; margin-top:0in; font-family:Liberation Serif; writing-mode:page; }
59          .P50 { font-size:130%; font-weight:bold; margin-bottom:0.0835in; margin-top:0.1665in; font-family:Liberation Sans; writing-mode:page; line-height:100%; }
60 <        .P51 { font-size:115%; font-weight:bold; margin-bottom:0.0835in; margin-top:0.139in; font-family:Liberation Sans; writing-mode:page; line-height:100%; }
60 >        .P51 { color:#808080; font-size:14pt; font-weight:bold; margin-bottom:0.0835in; margin-top:0.0972in; font-family:Liberation Sans; writing-mode:page; line-height:100%; }
61          .P52 { color:#808080; font-size:14pt; font-weight:bold; margin-bottom:0.0835in; margin-top:0.0972in; font-family:Liberation Sans; writing-mode:page; line-height:100%; }
62          .P53 { color:#808080; font-size:14pt; font-weight:bold; margin-bottom:0.0835in; margin-top:0.0972in; font-family:Liberation Sans; writing-mode:page; line-height:100%; }
63          .P54 { color:#808080; font-size:14pt; font-weight:bold; margin-bottom:0.0835in; margin-top:0.0972in; font-family:Liberation Sans; writing-mode:page; line-height:100%; }
64          .P55 { color:#808080; font-size:14pt; font-weight:bold; margin-bottom:0.0835in; margin-top:0.0972in; font-family:Liberation Sans; writing-mode:page; line-height:100%; }
65 <        .P56 { color:#808080; font-size:14pt; font-weight:bold; margin-bottom:0.0835in; margin-top:0.0972in; font-family:Liberation Sans; writing-mode:page; line-height:100%; }
66 <        .P57 { color:#808080; font-size:14pt; font-weight:bold; margin-bottom:0.0835in; margin-top:0.0972in; font-family:Liberation Sans; writing-mode:page; }
65 >        .P56 { color:#808080; font-size:14pt; font-weight:bold; margin-bottom:0.0835in; margin-top:0.0972in; font-family:Liberation Sans; writing-mode:page; }
66 >        .P57 { font-size:115%; font-weight:bold; margin-bottom:0.0835in; margin-top:0.139in; font-family:Liberation Sans; writing-mode:page; line-height:100%; }
67          .P6 { font-size:12pt; line-height:100%; margin-bottom:0.0972in; margin-top:0in; font-family:Liberation Serif; writing-mode:page; }
68          .P7 { font-size:12pt; line-height:100%; margin-bottom:0.0972in; margin-top:0in; font-family:Liberation Serif; writing-mode:page; }
69          .P8 { font-size:12pt; line-height:100%; margin-bottom:0.0972in; margin-top:0in; font-family:Liberation Serif; writing-mode:page; }
# Line 88 | Line 88
88          .T9 { font-weight:normal; }
89          <!-- ODF styles with no properties representable as CSS -->
90          .Table1.A .Table1.B .Table1.C .T1 .T13 .T14 .T15 .T16 .T17 .T18 .T19 .T20 .T21 .T22 .T23  { }
91 <        </style></head><body dir="ltr" style="max-width:8.2681in;margin-top:0.7874in; margin-bottom:0.7874in; margin-left:0.7874in; margin-right:0.7874in; writing-mode:lr-tb; "><h1 class="P49"><a id="a__The_TIBLocalDB_Support_Component"><span/></a>The TIBLocalDB Support Component</h1><p class="P1">TIBLocalDB is non-visual component supporting <span class="T15">a</span> TIBDatabase and intended to simplify the use of the embedded firebird server <span class="T23">for Personal Database Applications, </span>on both Linux and Windows platforms. <span class="T23">The TIBLocalDBSupport component supports GUI programs, while the TIBCMLocalDBSupport provides the same support for console mode programs</span>. <a href="#a_Example_applications" class="Internet_20_link"><span class="T22">Example applications</span></a><span class="T22"> are provided for both GUI and console mode in the ibx/examples/local-employeedb directory.</span></p><p class="P1">When enabled, <span class="T23">TIBLocalDBSupport</span> provides:</p><ul><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Verification that the embedded Firebird Server is in use.<span class="odfLiEnd"/> </p></li><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Setup of the FIREBIRD, FIREBIRD_TMP and FIREBIRD_LOCK environment variables suitable for the embedded server.<span class="odfLiEnd"/> </p></li><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>DatabaseName, and login parameters management.<span class="odfLiEnd"/> </p></li><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Use of the Firebird Services API to initialise an empty local database from a gbak format Firebird archive.<span class="odfLiEnd"/> </p></li><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Use of the Firebird Services API to save the current local database to a gbak format Firebird archive.<span class="odfLiEnd"/> </p></li><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Use of the Firebird Services API to replace the contents of the current local database from a gbak format Firebird archive.<span class="odfLiEnd"/> </p></li><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Use of the TIBXScript Engine for automated field upgrade of the local database.<span class="odfLiEnd"/> </p></li></ul><p class="P2">To use the component, <span class="T1">simply drop it onto a form or data module and link it to the TIBDatabase.</span></p><h3 class="P52"><a id="a__Properties"><span/></a>Properties</h3><ul><li><p class="P31" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">Database</span>: reference to the TIBDatabase component for the local database<span class="odfLiEnd"/> </p></li><li><p class="P37" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">DatabaseName</span>: filename (no path) to use for the Firebird Database file.<span class="odfLiEnd"/> </p></li><li><p class="P32" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">EmptyDBArchive</span>: filename (<span class="T13">optional</span> path) holding the database initialisation archive. <span class="T14">May either be absolute path or relative to </span><a href="#a_shared_data_directory" class="Internet_20_link"><span class="T14">shared data directory</span></a><span class="T14">.</span><span class="odfLiEnd"/> </p></li><li><p class="P31" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">Enabled</span>: when false component does nothing<span class="odfLiEnd"/> </p></li><li><p class="P33" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">FirebirdDirectory</span>: Full path to directory holding firebird.conf. <span class="T14">May either be absolute path or relative to the </span><a href="#a_shared_data_directory" class="Internet_20_link"><span class="T14">shared data directory</span></a><span class="T14">. </span>If empty, defaults to  <span class="T14">shared data directory.</span><span class="odfLiEnd"/> </p></li><li><p class="P31" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">Name</span>: Component Name<span class="odfLiEnd"/> </p></li><li><p class="P34" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T3">Options</span>: <span class="odfLiEnd"/> </p><ul><li><p class="P47" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">◦</span>iblAutoUpgrade: Automatically apply upgrade when database schema version is lower than required.<span class="odfLiEnd"/> </p></li><li><p class="P47" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">◦</span>IblAllowDowngrade: Automatically apply downgrade when available to schema version compatible with the required version.<span class="odfLiEnd"/> </p></li><li><p class="P48" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">◦</span><span class="T15">iblQuiet: </span> true then no database overwrite warnings<span class="odfLiEnd"/> </p></li></ul></li><li><p class="P39" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">RequiredVersionNo</span>: The schema version number required by the application. TIBLocalDBSupport will normally try to upgrade/downgrade the schema to satisfy this requirement.<span class="odfLiEnd"/> </p></li><li><p class="P33" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><a id="UpgradeConfFile"/><span class="T2">UpgradeConfFile</span>: Path to upgrade configuration file. May either be absolute path or relative to <span class="T18">the </span><a href="#a_shared_data_directory" class="Internet_20_link"><span class="T18">shared data directory</span></a>.<span class="odfLiEnd"/> </p></li><li><p class="P31" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">VendorName</span>: Used to construct path to Database Directory.<span class="odfLiEnd"/> </p></li></ul><p class="P9">Note that at design time paths may use '/' or '\' as directory separator. At run time, they must be specified using the appropriate Directory Separator for the current platform.</p><h3 class="P52"><a id="a__Events_"><span/></a>Events:</h3><ul><li><p class="P38" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">OnGetDatabaseName</span>: <span class="T17">The </span> database <span class="T23">path </span>name <span class="T16">is normally computed automatically</span>.  <span class="T16">However, this event allows an application to inspect and override the result.</span><span class="odfLiEnd"/> </p></li><li><p class="P35" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">OnNewDatabaseOpen</span>: called after the successful initialisation of an empty local database.<span class="odfLiEnd"/> </p></li><li><p class="P40" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><a id="OnGetDBVersionNo"/><span class="T2">OnGetDBVersionNo</span>: called to get the current database schema version number. If this event is not handled then schema upgrade/downgrade is never performed.<span class="odfLiEnd"/> </p></li><li><p class="P40" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">OnGetSharedDataDir</span>: The shared data directory is normally computed automatically. However, this event allows an application to inspect and override the result.<span class="odfLiEnd"/> </p></li></ul><h3 class="P53"><a id="a__Shared_Data_Directory"><span/></a>Shared Data Directory</h3><p class="P10">The shared data directory is the base directory for all static data files used by TIBLocalDBSupport. This is determined as follows:</p><ul><li><p class="P41" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Windows: the application executable's location.<span class="odfLiEnd"/> </p></li><li><p class="P42" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T1">Unix</span>:  the application executable's location unless this is /usr/bin, /usr/local/bin, /usr/sbin or /usr/local/sbin, when the shared data directory is set to /usr/share/&lt;application name&gt; or /usr/local/share/&lt;application name&gt; depending on whether the application is in /usr or /usr/local.<span class="odfLiEnd"/> </p></li></ul><p class="P26">Note: that the &lt;application name&gt; is taken from sysutils.ApplicationName and defaults to the filename of the application executable less any extension.</p><h3 class="P54"><a id="a__DatabaseName__and_login_parameters_management"><span/></a>DatabaseName, and login parameters management</h3><p class="P5">When <span class="T17">TIBLocalDBSupport</span> is in use, the TIBDatabase.DatabaseName property is ignored and instead, it is generated algorithmically as:</p><ul><li><p class="P36" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Windows: "User Application Directory"\VendorName\DatabaseName<span class="odfLiEnd"/> </p></li><li><p class="P36" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Unix: "User Home Directory"/."VendorName"/DatabaseName<span class="odfLiEnd"/> </p></li></ul><p class="P5">The “<span class="T1">DatabaseName” </span>comes from the <span class="T17">TIBLocalDBSupport</span>.<span class="T1">DatabaseName </span>property.</p><p class="P5">The “VendorName” comes from the  <span class="T17">TIBLocalDBSupport</span>.VendorName property. <span class="T1">If the TIBLocalDBSupport .VendorName property is left empty then Sysutils.VendorName is used. If this is empty then no VendorName component is present in the path.</span></p><p class="P3">Note the use of a hidden directory under Unix.</p><p class="P11">If the generated DatabaseName is not appropriate then the TIBLocalDB.OnGetDatabaseName event handler gives a chance to inspect it and change it to something different.</p><p class="P4">The Database Params are copied from the TIBDatabase component except that the “user_name” and “password” parameters are removed if present. When running under Windows, the “user_name” is <span class="T17">then</span> set to “SYSDBA” and the “password” to “masterkey”. Under Unix, these parameters are omitted.</p><h3 class="P52"><a id="a__Database_Initialisation"><span/></a>Database Initialisation</h3><p class="P12">When the linked TIBDatabase connected property is set to “true”, TIBLocalDB generates the DatabaseName (as described above) and then if it does not correspond to an existing file, <span class="T17">TIBLocalDBSupport</span> uses the Firebird Services API to create the database file from an “empty database” archive in gbak format. In practice, the archive can contain both the database metadata and initial table data.</p><p class="P13">The “empty database” archive is given by the <span class="T17">TIBLocalDBSupport</span>, <span class="T5">EmptyDBArchive </span><span class="T4">property. This should be a filename (usually with the .gbk extension) </span><span class="T7">and </span><span class="T8">may include </span><span class="T7">an optional path</span><span class="T4">.  </span><span class="T7">Relative paths are</span><span class="T6"> </span><span class="T8">interpreted as </span><span class="T6">relative to the </span><a href="#a_shared_data_directory" class="Internet_20_link"><span class="T7">shared data directory</span></a><span class="T6">.</span></p><p class="P14">The Services API is then used to create the initial database from this archive. An error is raised if the archive is not present.</p><p class="P15">The local database can be re-initialised at any time by calling the <span class="T17">TIBLocalDBSupport</span>.NewDatabase method.</p><h3 class="P55"><a id="a__Saving_the_Current_Database"><span/></a>Saving the Current Database</h3><p class="P15">The current database contents can be saved at any time by a call to <span class="T17">TIBLocalDBSupport</span>.SaveDatabase. The filename for the archive can be provided in the method call. If empty, then the user is prompted to enter a filename (default extension .gbk).</p><p class="P16">The Services API is then called to archive the database to the specified file in gbak format.</p><h3 class="P55"><a id="a__Restoring_the_Database_from_an_Archive"><span/></a>Restoring the Database from an Archive</h3><p class="P15">The local database can be overwritten (restored) from any archive in gbak format (including those saved using the SaveDatabase method) by calling the <span class="T17">TIBLocalDBSupport</span>.RestoreDatabase method. The filename for the source archive can be provide in the method call.  If empty, then the user is prompted to locate the file.</p><p class="P16">The Services API is then called to restore the local database from the archive.</p><h3 class="P56"><a id="a__Database_Schema_Upgrade"><span/></a>Database Schema Upgrade</h3><p class="P17">A Software Application Update can also require a corresponding update to the database schema. With embedded Firebird server applications where the user may not even be aware that a database server is in use, it is important to have a means to field upgrade the database schema in as seamless and automatic a manner as possible. TIBLocalDB<span class="T18">Support</span> supports a suitable mechanism using the TIBXScript engine.</p><p class="P18">The underlying idea is that the database schema comes with a version number given as a single integer. The first version to be released is version 1, the second is version 2 and so on. The current schema version number must be saved as data somewhere in the database. As this is database schema dependent,  <span class="T19">TIBLocalDB</span>Support does not know how to determine the current database schema number and instead relies upon the application responding to the <a href="#OnGetDBVersionNo" class="Internet_20_link"><span class="T9">OnGetDBVersionNo</span></a><span class="T9"> </span><span class="T4">event.</span></p><p class="P6"><span class="T4">Each version of an application will have a maximum and minimum version of the database schema that it can support, and it is expected to check that the schema version is acceptable in its TIBDatabase OnConnect handler. However, before this handler is called,  </span><span class="T11">TIBLocalDB</span><span class="T10">Support </span><span class="T4">will itself check the current schema version against its RequiredVersionNo property (which should be set to the maximum supported schema version no). </span></p><ul><li><p class="P43" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T12">If iblAutoUpgrade is given in the Options property and the current schema is less than the Required Version no., then  </span><span class="T11">TIBLocalDB</span><span class="T10">Support </span><span class="T12">will attempt to apply the upgrade rules to </span><span class="T12">raise the version number to that required.</span><span class="odfLiEnd"/> </p></li><li><p class="P44" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T12">I</span><span class="T4">f iblAllowDowngrade is given in the Options property and the current schema is greater than the Required Version no., then </span><span class="T11">TIBLocalDB</span><span class="T10">Support </span><span class="T4">will attempt to locate a suitable backup archive and restore this as the current database. This case is usually only found in the unlikely event of a failed upgrade and the user has installed an older version of the software in order to recover from the problem.</span><span class="odfLiEnd"/> </p></li></ul><p class="P18">The schema upgrade rules are read from the <a href="#UpgradeConfFile" class="Internet_20_link"><span class="T1">upgrade configuration file</span></a><span class="T1">. </span>This is a text file in “ini” file format with the following sections:</p><p class="P19">[status<span class="T21">]</span></p><p class="P18">This should have a single named value “current” giving the current database schema number as in integer e.g.</p><p class="P19">current = 2</p><p class="P18">This should normally be set to the same value as the RequiredVersionNo property and acts as a check to ensure that both are in sync.</p><p class="P19">[Version.nnn]</p><p class="P18">Where nnn is an integer with leaving zeroes. For example, “Version.002” is the section read to upgrade the database schema from version 1 to version 2. <span class="T20">This section can contain the following named values:</span></p><table border="0" cellspacing="0" cellpadding="0" class="Table1"><colgroup><col/><col/><col/></colgroup><tr><td style="text-align:left;" class="Table1_A1"><p class="P27">Name</p></td><td style="text-align:left;" class="Table1_A1"><p class="P27">Type</p></td><td style="text-align:left;" class="Table1_C1"><p class="P27">Use</p></td></tr><tr><td style="text-align:left;" class="Table1_A2"><p class="P28">Upgrade</p></td><td style="text-align:left;" class="Table1_A2"><p class="P28"><span class="T23">s</span>tring</p></td><td style="text-align:left;" class="Table1_C2"><p class="P28">Name and optional path to <span class="T23">the </span>SQL script used to perform the upgrade. <span class="T1">May either be absolute path or relative to the </span>upgrade configuration file. Either forwards or back slashes may be used as the path delimiter.</p></td></tr><tr><td style="text-align:left;" class="Table1_A2"><p class="P28">Msg</p></td><td style="text-align:left;" class="Table1_A2"><p class="P28">string</p></td><td style="text-align:left;" class="Table1_C2"><p class="P28">Text message displayed in progress dialog while script is active.  Defaults to “Upgrading Database Schema to Version nnn”.</p></td></tr><tr><td style="text-align:left;" class="Table1_A2"><p class="P28">BackupDatabase</p></td><td style="text-align:left;" class="Table1_A2"><p class="P28">yes/no</p></td><td style="text-align:left;" class="Table1_C2"><p class="P28">If present and set to “yes” then a database backup in gbak format is made before the upgrade is performed. The backup file is located in the same directory as the database file and is given the same name as the database file with the extension replaced with “.nnn.gbak”. Where “nnn” is the current schema version number (i.e. prior to running the upgrade script).</p></td></tr><tr><td style="text-align:left;" class="Table1_A2"><p class="P28">&lt;Parameter Name&gt;</p></td><td style="text-align:left;" class="Table1_A2"><p class="P28">string</p></td><td style="text-align:left;" class="Table1_C2"><p class="P29">Name and optional path to binary data file. <span class="T1">May either be absolute path or relative to the </span>upgrade configuration file. Either forwards or back slashes may be used as the path delimiter.</p></td></tr></table><p class="P18"> </p><p class="P21">For example:</p><p class="P25">[Version.002]</p><p class="P25">Msg = Upgrading to Version 2</p><p class="P25">BackupDatabase = yes</p><p class="P25">Upgrade = patches/02-patch.sql</p><p class="P20">mugshot = images/man.png.gz   </p><p class="P21">Note that in the above, “mugshot” is intended to be used to resolve an Update, Insert or Delete query parameter in the 02-patch.sql file. E.g.</p><p class="P20">Update EMPLOYEE Set Photo =:MUGSHOT Where Emp_no = 2; </p><p class="P21">This is only applicable to BLOB columns and the above is interpreted as update the EMPLOYEE table where the Emp_no is “2” and set the value of the Photo column to the binary data contained in the file “images/man.png.gz”. The “.gz” extension is recognised as a gzip compressed file and decompressed before updating the table.</p><p class="P22">When the current database schema is more than one version number less than that required, the upgrade rules are applied iteratively to upgrade the database to the required schema version.</p><h1 class="P50"><a id="a__Local_EmployeeDB_Example"><span/></a>Local EmployeeDB Example</h1><p class="P7">The purpose of this example is to demonstrate the use of the TIBLocalDB<span class="T22">S</span>upport component. This component is used with a TIBDatabase when the database is accessed using the Firebird Embedded Server. TIBLocalDB<span class="T22">S</span>upport takes care of checking the environment and setting up FIREBIRD environment variables and DB parameters. It also supports initialisation of the local database from an archive in gbak format, plus save and restore of the local database. It can also run SQL scripts to upgrade the database schema when a new software version is released.</p><p class="P23">The example can be found under: ibx/examples/local-employeedb/project1.lpi</p><p class="P23">See also <a href="#a_console_mode" class="Internet_20_link">console mode</a>.</p><p class="P8">Before compiling and running the example, the Firebird embedded server must be installed:</p><h2 class="P51"><a id="a__Under_Linux_"><span/></a>Under Linux:</h2><ul><li><p class="P45" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Debian/Ubuntu/Mint: run "sudo apt-get install libfbembed2.5" to install the server<span class="odfLiEnd"/> </p></li><li><p class="P45" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Fedora/Red hat/Centos: su -c "yum install firebird-libfbembed"<span class="odfLiEnd"/> </p></li></ul><h2 class="P51"><a id="a__Under_Windows_"><span/></a>Under Windows:</h2><p class="P8">Download the Firebird Embedded Server from http://www.firebirdsql.org/en/firebird-2-5-5/ and extract the contents of the archive into the example directory i.e. ibx\examples\local-employeedb</p><h2 class="P51"><a id="a__Running_the_application"><span/></a>Running the application</h2><p class="P8">The example should just compile and run. An archive of the Firebird example employee database is provided with the example. This will be used to create the initial database. It should then be automatically upgraded to "version 2" using the scripts provided in the "patches" directory. (see also the file upgrade.conf).</p><p class="P8">Note that you will not be prompted for a username/password. The embedded server uses normal file permissions to control access. Otherwise you can edit the employee database as in the client/server version.</p><p class="P8">The local database will be created in:</p><ul><li><p class="P46" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Linux: $HOME/.MWA Software/employee.fdb<span class="odfLiEnd"/> </p></li><li><p class="P46" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Windows: &lt;User Application Data Folder&gt;\MWA Software\employee.fdb<span class="odfLiEnd"/> </p></li></ul><p class="P8">The File menu provides actions to save the current database to a gbak format archive, restore it again (replacing the current database) or to restore the database to its initial state.</p><h3 class="P57"><a id="a__Console_Mode"><span/></a>Console Mode</h3><p class="P24">A console mode version of the example application is also provided under ibx/examples/local-employeedb/ConsoleModeExample.lpi.</p><p class="P24">Like all IBX console mode applications, this uses the ibexpressconsolemode package. The IBCMLocalDBSupport unit is used to provide the TIBCMLocalDBSupport compoent.</p><p class="P24">The application is similar to the above and uses the same archive database and upgrade scripts. Instead of displaying the employee table, when run it will print out the first two rows.</p></body></html>
91 >        </style></head><body dir="ltr" style="max-width:8.2681in;margin-top:0.7874in; margin-bottom:0.7874in; margin-left:0.7874in; margin-right:0.7874in; writing-mode:lr-tb; "><h1 class="P49"><a id="a__The_TIBLocalDB_Support_Component"><span/></a>The TIBLocalDB Support Component</h1><p class="P1">TIBLocalDB is non-visual component supporting <span class="T15">a</span> TIBDatabase and intended to simplify the use of the embedded firebird server <span class="T23">for Personal Database Applications, </span>on both Linux and Windows platforms. <span class="T23">The TIBLocalDBSupport component supports GUI programs, while the TIBCMLocalDBSupport provides the same support for console mode programs</span>. <a href="#a_Example_applications" class="Internet_20_link"><span class="T22">Example applications</span></a><span class="T22"> are provided for both GUI and console mode in the ibx/examples/local-employeedb directory.</span></p><p class="P1">When enabled, <span class="T23">TIBLocalDBSupport</span> provides:</p><ul><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Verification that the embedded Firebird Server is in use.<span class="odfLiEnd"/> </p></li><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Setup of the FIREBIRD, FIREBIRD_TMP and FIREBIRD_LOCK environment variables suitable for the embedded server.<span class="odfLiEnd"/> </p></li><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>DatabaseName, and login parameters management.<span class="odfLiEnd"/> </p></li><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Use of the Firebird Services API to initialise an empty local database from a gbak format Firebird archive.<span class="odfLiEnd"/> </p></li><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Use of the Firebird Services API to save the current local database to a gbak format Firebird archive.<span class="odfLiEnd"/> </p></li><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Use of the Firebird Services API to replace the contents of the current local database from a gbak format Firebird archive.<span class="odfLiEnd"/> </p></li><li><p class="P30" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Use of the TIBXScript Engine for automated field upgrade of the local database.<span class="odfLiEnd"/> </p></li></ul><p class="P2">To use the component, <span class="T1">simply drop it onto a form or data module and link it to the TIBDatabase.</span></p><h3 class="P51"><a id="a__Properties"><span/></a>Properties</h3><ul><li><p class="P31" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">Database</span>: reference to the TIBDatabase component for the local database<span class="odfLiEnd"/> </p></li><li><p class="P37" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">DatabaseName</span>: filename (no path) to use for the Firebird Database file.<span class="odfLiEnd"/> </p></li><li><p class="P32" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">EmptyDBArchive</span>: filename (<span class="T13">optional</span> path) holding the database initialisation archive. <span class="T14">May either be absolute path or relative to </span><a href="#a_shared_data_directory" class="Internet_20_link"><span class="T14">shared data directory</span></a><span class="T14">.</span><span class="odfLiEnd"/> </p></li><li><p class="P31" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">Enabled</span>: when false component does nothing<span class="odfLiEnd"/> </p></li><li><p class="P33" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">FirebirdDirectory</span>: Full path to directory holding firebird.conf. <span class="T14">May either be absolute path or relative to the </span><a href="#a_shared_data_directory" class="Internet_20_link"><span class="T14">shared data directory</span></a><span class="T14">. </span>If empty, defaults to  <span class="T14">shared data directory.</span><span class="odfLiEnd"/> </p></li><li><p class="P31" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">Name</span>: Component Name<span class="odfLiEnd"/> </p></li><li><p class="P34" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T3">Options</span>: <span class="odfLiEnd"/> </p><ul><li><p class="P47" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">◦</span>iblAutoUpgrade: Automatically apply upgrade when database schema version is lower than required.<span class="odfLiEnd"/> </p></li><li><p class="P47" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">◦</span>IblAllowDowngrade: Automatically apply downgrade when available to schema version compatible with the required version.<span class="odfLiEnd"/> </p></li><li><p class="P48" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">◦</span><span class="T15">iblQuiet: </span> true then no database overwrite warnings<span class="odfLiEnd"/> </p></li></ul></li><li><p class="P39" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">RequiredVersionNo</span>: The schema version number required by the application. TIBLocalDBSupport will normally try to upgrade/downgrade the schema to satisfy this requirement.<span class="odfLiEnd"/> </p></li><li><p class="P33" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><a id="UpgradeConfFile"/><span class="T2">UpgradeConfFile</span>: Path to upgrade configuration file. May either be absolute path or relative to <span class="T18">the </span><a href="#a_shared_data_directory" class="Internet_20_link"><span class="T18">shared data directory</span></a>.<span class="odfLiEnd"/> </p></li><li><p class="P31" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">VendorName</span>: Used to construct path to Database Directory.<span class="odfLiEnd"/> </p></li></ul><p class="P9">Note that at design time paths may use '/' or '\' as directory separator. At run time, they must be specified using the appropriate Directory Separator for the current platform.</p><h3 class="P51"><a id="a__Events_"><span/></a>Events:</h3><ul><li><p class="P38" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">OnGetDatabaseName</span>: <span class="T17">The </span> database <span class="T23">path </span>name <span class="T16">is normally computed automatically</span>.  <span class="T16">However, this event allows an application to inspect and override the result.</span><span class="odfLiEnd"/> </p></li><li><p class="P35" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">OnNewDatabaseOpen</span>: called after the successful initialisation of an empty local database.<span class="odfLiEnd"/> </p></li><li><p class="P40" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><a id="OnGetDBVersionNo"/><span class="T2">OnGetDBVersionNo</span>: called to get the current database schema version number. If this event is not handled then schema upgrade/downgrade is never performed.<span class="odfLiEnd"/> </p></li><li><p class="P40" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T2">OnGetSharedDataDir</span>: The shared data directory is normally computed automatically. However, this event allows an application to inspect and override the result.<span class="odfLiEnd"/> </p></li></ul><h3 class="P52"><a id="a__Shared_Data_Directory"><span/></a>Shared Data Directory</h3><p class="P10">The shared data directory is the base directory for all static data files used by TIBLocalDBSupport. This is determined as follows:</p><ul><li><p class="P41" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Windows: the application executable's location.<span class="odfLiEnd"/> </p></li><li><p class="P42" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T1">Unix</span>:  the application executable's location unless this is /usr/bin, /usr/local/bin, /usr/sbin or /usr/local/sbin, when the shared data directory is set to /usr/share/&lt;application name&gt; or /usr/local/share/&lt;application name&gt; depending on whether the application is in /usr or /usr/local.<span class="odfLiEnd"/> </p></li></ul><p class="P26">Note: that the &lt;application name&gt; is taken from sysutils.ApplicationName and defaults to the filename of the application executable less any extension.</p><h3 class="P53"><a id="a__DatabaseName__and_login_parameters_management"><span/></a>DatabaseName, and login parameters management</h3><p class="P5">When <span class="T17">TIBLocalDBSupport</span> is in use, the TIBDatabase.DatabaseName property is ignored and instead, it is generated algorithmically as:</p><ul><li><p class="P36" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Windows: "User Application Directory"\VendorName\DatabaseName<span class="odfLiEnd"/> </p></li><li><p class="P36" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Unix: "User Home Directory"/."VendorName"/DatabaseName<span class="odfLiEnd"/> </p></li></ul><p class="P5">The “<span class="T1">DatabaseName” </span>comes from the <span class="T17">TIBLocalDBSupport</span>.<span class="T1">DatabaseName </span>property.</p><p class="P5">The “VendorName” comes from the  <span class="T17">TIBLocalDBSupport</span>.VendorName property. <span class="T1">If the TIBLocalDBSupport .VendorName property is left empty then Sysutils.VendorName is used. If this is empty then no VendorName component is present in the path.</span></p><p class="P3">Note the use of a hidden directory under Unix.</p><p class="P11">If the generated DatabaseName is not appropriate then the TIBLocalDB.OnGetDatabaseName event handler gives a chance to inspect it and change it to something different.</p><p class="P4">The Database Params are copied from the TIBDatabase component except that the “user_name” and “password” parameters are removed if present. When running under Windows, the “user_name” is <span class="T17">then</span> set to “SYSDBA” and the “password” to “masterkey”. Under Unix, these parameters are omitted.</p><h3 class="P51"><a id="a__Database_Initialisation"><span/></a>Database Initialisation</h3><p class="P12">When the linked TIBDatabase connected property is set to “true”, TIBLocalDB generates the DatabaseName (as described above) and then if it does not correspond to an existing file, <span class="T17">TIBLocalDBSupport</span> uses the Firebird Services API to create the database file from an “empty database” archive in gbak format. In practice, the archive can contain both the database metadata and initial table data.</p><p class="P13">The “empty database” archive is given by the <span class="T17">TIBLocalDBSupport</span>, <span class="T5">EmptyDBArchive </span><span class="T4">property. This should be a filename (usually with the .gbk extension) </span><span class="T7">and </span><span class="T8">may include </span><span class="T7">an optional path</span><span class="T4">.  </span><span class="T7">Relative paths are</span><span class="T6"> </span><span class="T8">interpreted as </span><span class="T6">relative to the </span><a href="#a_shared_data_directory" class="Internet_20_link"><span class="T7">shared data directory</span></a><span class="T6">.</span></p><p class="P14">The Services API is then used to create the initial database from this archive. An error is raised if the archive is not present.</p><p class="P15">The local database can be re-initialised at any time by calling the <span class="T17">TIBLocalDBSupport</span>.NewDatabase method.</p><h3 class="P54"><a id="a__Saving_the_Current_Database"><span/></a>Saving the Current Database</h3><p class="P15">The current database contents can be saved at any time by a call to <span class="T17">TIBLocalDBSupport</span>.SaveDatabase. The filename for the archive can be provided in the method call. If empty, then the user is prompted to enter a filename (default extension .gbk).</p><p class="P16">The Services API is then called to archive the database to the specified file in gbak format.</p><h3 class="P54"><a id="a__Restoring_the_Database_from_an_Archive"><span/></a>Restoring the Database from an Archive</h3><p class="P15">The local database can be overwritten (restored) from any archive in gbak format (including those saved using the SaveDatabase method) by calling the <span class="T17">TIBLocalDBSupport</span>.RestoreDatabase method. The filename for the source archive can be provide in the method call.  If empty, then the user is prompted to locate the file.</p><p class="P16">The Services API is then called to restore the local database from the archive.</p><h3 class="P55"><a id="a__Database_Schema_Upgrade"><span/></a>Database Schema Upgrade</h3><p class="P17">A Software Application Update can also require a corresponding update to the database schema. With embedded Firebird server applications where the user may not even be aware that a database server is in use, it is important to have a means to field upgrade the database schema in as seamless and automatic a manner as possible. TIBLocalDB<span class="T18">Support</span> supports a suitable mechanism using the TIBXScript engine.</p><p class="P18">The underlying idea is that the database schema comes with a version number given as a single integer. The first version to be released is version 1, the second is version 2 and so on. The current schema version number must be saved as data somewhere in the database. As this is database schema dependent,  <span class="T19">TIBLocalDB</span>Support does not know how to determine the current database schema number and instead relies upon the application responding to the <a href="#OnGetDBVersionNo" class="Internet_20_link"><span class="T9">OnGetDBVersionNo</span></a><span class="T9"> </span><span class="T4">event.</span></p><p class="P6"><span class="T4">Each version of an application will have a maximum and minimum version of the database schema that it can support, and it is expected to check that the schema version is acceptable in its TIBDatabase OnConnect handler. However, before this handler is called,  </span><span class="T11">TIBLocalDB</span><span class="T10">Support </span><span class="T4">will itself check the current schema version against its RequiredVersionNo property (which should be set to the maximum supported schema version no). </span></p><ul><li><p class="P43" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T12">If iblAutoUpgrade is given in the Options property and the current schema is less than the Required Version no., then  </span><span class="T11">TIBLocalDB</span><span class="T10">Support </span><span class="T12">will attempt to apply the upgrade rules to </span><span class="T12">raise the version number to that required.</span><span class="odfLiEnd"/> </p></li><li><p class="P44" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span><span class="T12">I</span><span class="T4">f iblAllowDowngrade is given in the Options property and the current schema is greater than the Required Version no., then </span><span class="T11">TIBLocalDB</span><span class="T10">Support </span><span class="T4">will attempt to locate a suitable backup archive and restore this as the current database. This case is usually only found in the unlikely event of a failed upgrade and the user has installed an older version of the software in order to recover from the problem.</span><span class="odfLiEnd"/> </p></li></ul><p class="P18">The schema upgrade rules are read from the <a href="#UpgradeConfFile" class="Internet_20_link"><span class="T1">upgrade configuration file</span></a><span class="T1">. </span>This is a text file in “ini” file format with the following sections:</p><p class="P19">[status<span class="T21">]</span></p><p class="P18">This should have a single named value “current” giving the current database schema number as in integer e.g.</p><p class="P19">current = 2</p><p class="P18">This should normally be set to the same value as the RequiredVersionNo property and acts as a check to ensure that both are in sync.</p><p class="P19">[Version.nnn]</p><p class="P18">Where nnn is an integer with leaving zeroes. For example, “Version.002” is the section read to upgrade the database schema from version 1 to version 2. <span class="T20">This section can contain the following named values:</span></p><table border="0" cellspacing="0" cellpadding="0" class="Table1"><colgroup><col/><col/><col/></colgroup><tr><td style="text-align:left;" class="Table1_A1"><p class="P27">Name</p></td><td style="text-align:left;" class="Table1_A1"><p class="P27">Type</p></td><td style="text-align:left;" class="Table1_C1"><p class="P27">Use</p></td></tr><tr><td style="text-align:left;" class="Table1_A2"><p class="P28">Upgrade</p></td><td style="text-align:left;" class="Table1_A2"><p class="P28"><span class="T23">s</span>tring</p></td><td style="text-align:left;" class="Table1_C2"><p class="P28">Name and optional path to <span class="T23">the </span>SQL script used to perform the upgrade. <span class="T1">May either be absolute path or relative to the </span>upgrade configuration file. Either forwards or back slashes may be used as the path delimiter.</p></td></tr><tr><td style="text-align:left;" class="Table1_A2"><p class="P28">Msg</p></td><td style="text-align:left;" class="Table1_A2"><p class="P28">string</p></td><td style="text-align:left;" class="Table1_C2"><p class="P28">Text message displayed in progress dialog while script is active.  Defaults to “Upgrading Database Schema to Version nnn”.</p></td></tr><tr><td style="text-align:left;" class="Table1_A2"><p class="P28">BackupDatabase</p></td><td style="text-align:left;" class="Table1_A2"><p class="P28">yes/no</p></td><td style="text-align:left;" class="Table1_C2"><p class="P28">If present and set to “yes” then a database backup in gbak format is made before the upgrade is performed. The backup file is located in the same directory as the database file and is given the same name as the database file with the extension replaced with “.nnn.gbak”. Where “nnn” is the current schema version number (i.e. prior to running the upgrade script).</p></td></tr><tr><td style="text-align:left;" class="Table1_A2"><p class="P28">&lt;Parameter Name&gt;</p></td><td style="text-align:left;" class="Table1_A2"><p class="P28">string</p></td><td style="text-align:left;" class="Table1_C2"><p class="P29">Name and optional path to binary data file. <span class="T1">May either be absolute path or relative to the </span>upgrade configuration file. Either forwards or back slashes may be used as the path delimiter.</p></td></tr></table><p class="P18"> </p><p class="P21">For example:</p><p class="P25">[Version.002]</p><p class="P25">Msg = Upgrading to Version 2</p><p class="P25">BackupDatabase = yes</p><p class="P25">Upgrade = patches/02-patch.sql</p><p class="P20">mugshot = images/man.png.gz   </p><p class="P21">Note that in the above, “mugshot” is intended to be used to resolve an Update, Insert or Delete query parameter in the 02-patch.sql file. E.g.</p><p class="P20">Update EMPLOYEE Set Photo =:MUGSHOT Where Emp_no = 2; </p><p class="P21">This is only applicable to BLOB columns and the above is interpreted as update the EMPLOYEE table where the Emp_no is “2” and set the value of the Photo column to the binary data contained in the file “images/man.png.gz”. The “.gz” extension is recognised as a gzip compressed file and decompressed before updating the table.</p><p class="P22">When the current database schema is more than one version number less than that required, the upgrade rules are applied iteratively to upgrade the database to the required schema version.</p><h1 class="P50"><a id="a__Local_EmployeeDB_Example"><span/></a>Local EmployeeDB Example</h1><p class="P7">The purpose of this example is to demonstrate the use of the TIBLocalDB<span class="T22">S</span>upport component. This component is used with a TIBDatabase when the database is accessed using the Firebird Embedded Server. TIBLocalDB<span class="T22">S</span>upport takes care of checking the environment and setting up FIREBIRD environment variables and DB parameters. It also supports initialisation of the local database from an archive in gbak format, plus save and restore of the local database. It can also run SQL scripts to upgrade the database schema when a new software version is released.</p><p class="P23">The example can be found under: ibx/examples/local-employeedb/project1.lpi</p><p class="P23">See also <a href="#a_console_mode" class="Internet_20_link">console mode</a>.</p><p class="P8">Before compiling and running the example, the Firebird embedded server must be installed:</p><h2 class="P57"><a id="a__Under_Linux_"><span/></a>Under Linux:</h2><ul><li><p class="P45" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Debian/Ubuntu/Mint: run "sudo apt-get install libfbembed2.5" to install the server<span class="odfLiEnd"/> </p></li><li><p class="P45" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Fedora/Red hat/Centos: su -c "yum install firebird-libfbembed"<span class="odfLiEnd"/> </p></li></ul><h2 class="P57"><a id="a__Under_Windows_"><span/></a>Under Windows:</h2><p class="P8">Download the Firebird Embedded Server from http://www.firebirdsql.org/en/firebird-2-5-5/ and extract the contents of the archive into the example directory i.e. ibx\examples\local-employeedb</p><h2 class="P57"><a id="a__Running_the_application"><span/></a>Running the application</h2><p class="P8">The example should just compile and run. An archive of the Firebird example employee database is provided with the example. This will be used to create the initial database. It should then be automatically upgraded to "version 2" using the scripts provided in the "patches" directory. (see also the file upgrade.conf).</p><p class="P8">Note that you will not be prompted for a username/password. The embedded server uses normal file permissions to control access. Otherwise you can edit the employee database as in the client/server version.</p><p class="P8">The local database will be created in:</p><ul><li><p class="P46" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Linux: $HOME/.MWA Software/employee.fdb<span class="odfLiEnd"/> </p></li><li><p class="P46" style="margin-left:0cm;"><span class="Bullet_20_Symbols" style="display:block;float:left;min-width:0.635cm;">•</span>Windows: &lt;User Application Data Folder&gt;\MWA Software\employee.fdb<span class="odfLiEnd"/> </p></li></ul><p class="P8">The File menu provides actions to save the current database to a gbak format archive, restore it again (replacing the current database) or to restore the database to its initial state.</p><h3 class="P56"><a id="a__Console_Mode"><span/></a>Console Mode</h3><p class="P24">A console mode version of the example application is also provided under ibx/examples/local-employeedb/ConsoleModeExample.lpi.</p><p class="P24">Like all IBX console mode applications, this uses the ibexpressconsolemode package. The IBCMLocalDBSupport unit is used to provide the TIBCMLocalDBSupport compoent.</p><p class="P24">The application is similar to the above and uses the same archive database and upgrade scripts. Instead of displaying the employee table, when run it will print out the first two rows.</p></body></html>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines