Although CONNECT provides a rich set of table types, specific applications may need to access data organized in a way that is not handled by its existing foreign data wrappers (FDW). To handle these cases, CONNECT features an interface that enables developers to implement in C++ the required table wrapper and use it as if it were part of the standard CONNECT table type list. CONNECT can use these additional handlers providing the corresponding external module (dll or shared lib) be available.
To create such a table on an existing handler, use a Create Table statement as shown below.
create table xtab (column definitions) engine=CONNECT table_type=OEM module='libname' subtype='MYTYPE' [standard table options] Option_list='Myopt=foo';
The option module gives the name of the DLL or shared library implementing the OEM wrapper for the table type. This library must be located in the plugin directory like all other plugins or UDF’s.
This library must export a function GetMYTYPE. The option subtype enables CONNECT to have the name of the exported function and to use the new table type. Other options are interpreted by the OEM type and can also be specified within the option_list option.
Column definitions can be unspecified only if the external wrapper is able to return this information. For this it must export a function ColMYTYPE returning these definitions in a format acceptable by the CONNECT discovery function.
Which and how options must be specified and the way columns must be defined may vary depending on the OEM type used and should be documented by the OEM type implementer(s).
An OEM table example
The OEM table
FIC whose source is shown on appendix is handling the Windev
FIC format. They are fixed size files in which numeric values are stored not in
characters but using platform representation.
However the data type monetary does not exist in CONNECT. This is why the BIN type cannot be used as is and must be called from this table type that provides conversion for Monetary. In addition, FIC files contain soft deleted rows as in dBASE files.
Of course, the tabfic.dll exporting the GetFIC function must be available for all this to work.
Some currently available OEM table modules and subtypes
|libhello||HELLO||A sample OEM wrapper displaying a one line table saying “Hello world”|
|Tabfic||FIC||Handles files having the Windev HyperFile format.|
|Tabofx||OFC||Handles Open Financial Connectivity files.|
|Tabofx||QIF||Handles Quicken Interchange Format files.|
|Cirpack||CRPK||Handles CDR's from Cirpack UTP's.|
|Tabplg||PLG||Access tables from the PlugDB DBMS.|
How to implement an OEM handler is out of the scope of this document.