W3cubDocs

/MariaDB

CONNECT Table Types - OEM: Implemented in an External LIB

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 MONGO (see CONNECT - OEM Table Example for an example with source) permits using MONGO-like tables with MariaDB binary distributions containing but not enabling the MONGO table type

Of course, the mongo (dll or so) exporting the GetMONGO and ColMONGO functions must be available in the plugin directory for all this to work.

Some Currently Available OEM Table Modules and Subtypes

Module Subtype Description
libhello HELLO A sample OEM wrapper displaying a one line table saying “Hello world”
mongo MONGO Enables using tables based on MongoDB collections.
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.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/connect-table-types-oem/