Omnis Technical Note TNNO0005

The ODBC Driver for Datafile Access and $publicdata property

For Omnis 7.3.7 and Studio 2.0.
By Tom Hume

How do I control datafile access using $publicdata?

Omnis 7.3 Version 7 and Omnis Studio 2.x under Windows both provide a new DLL that makes
access to Omnis data files more open. The ODBC driver provides read-only access to Omnis data files.


Installing the ODBC Driver

To install the Omnis data file ODBC driver:

1. Copy omodbc32.dll into c:\windows\system
2. Run omodbcin.exe, and select the menu item to install the driver.

The Omnis driver should now appear in the 32 bit ODBC control panel. Note that because the driver conforms to the version v3.0 ODBC API, it requires the ODBC 3.0 Driver Manager. On Windows, this
ships with the data access component of Microsoft Office 97.

You will need to set the public data property ($publicdata) of data file slots which are to be accessible using ODBC.


What is $publicdata?

In Omnis 7 file formats, or classes in Studio, have a new $publicdata property which when set to true allows any data belonging to the file to be read using the new ODBC driver.

By setting it to false for individual files, you can stop unauthorised access via the driver. $publicdata defaults to false for all existing and new file formats. The value of $publicdata is stored in the data dictionary of the data file when you update the data dictionary. At present the ODBC driver is available
for the Windows 32 bit platform and PowerMac.


Datafile Access Control

In order to allow certain file formats to be read, the $publicdata property must be set to true. The process is slightly different for Omnis 7 and Omnis Studio. For Omnis 7, firstly open the datafile containing the formats that are to have the $publicdata property affected. For each file format required for public reading, a new selection in the modify menu, 'Has public data', should be checked. When all of the required file formats have been checked the datafile will need reorganising. To achieve this, 'Data File Tools' should
be selected from the Utilities menu, followed by 'Check Data File'. From the subsequent dialog box, the intended file and the ÔUpdate Data DictionaryÕ should then be selected.

The datafile can be checked using the 'Examine datafile' option from the Utilities menu. A summary of the file formats, both available and unavailable for read access, can then be viewed.

In Omnis Studio the process is simpler still. In the Property Manager of the file class there is a publicdata property that is set to kFalse by default. Change to kTrue for file classes to be made available for public access.

Using Notation In Omnis 7 you can use the following notation to set $publicdata:


$root.$libs.library name.
     $files.file_name.$head.$publicdata.$assign(kTrue)

In Omnis Studio the notation used is as follows:


$root.$libs.library name.
     $files.file_name.$publicdata.$assign(kTrue)