The code provided here implements a very simple Uniface database driver.
It is based on the information in the Uniface DBMS Driver Cookbook (provided
as dbc.pdf with Uniface) and some experimentation. The example is perhaps not
that useful, but does demonstrate how to construct a database driver.
This example driver allows any key from the DRIVER_SETTINGS section of
the ASN file to be read (or files, if there are include ASN files). It also allows
any key of any section in the Uniface client INI file to be read (as opposed to
the usys.ini file in the Uniface bin directory).
It uses the Uniface service function udgetasn to read the ASN file(s), and a
combination of UGETPROFILE and GetPrivateProfileString to read the
INI file. Note that Uniface now provides a function which should be used in
place of GetPrivateProfileString called UREADSTRINGSYSSETTING,
however it was not used in this example.
To use this example driver from Uniface the database driver DLL, driver.dll,
must be included on the demandload line of the Uniface INI file. If this has
been done then the following Uniface proc code should correctly return the
value of the USYS$MSS_PARAMS key from the ASN file(s):
sql "ASN;USYS$MSS_PARAMS", "UD5"
The resulting string is returned in $result, and if there is an error, $status and
$dberror will be set appropriately. Note that it is not necessary to perform
an open or close on the database driver path.
Notes
This example driver was developed and tested using Microsoft Visual C++ 5.0
and Uniface 7.2.04 on Windows NT.
Some experimentation was required to correctly populate the driver information
(in response to driver request code I) and due to this the example driver may
be unstable.