Qore DatasourceProvider Module Reference  1.1

DatasourceProvider Module Introduction

The DatasourceProvider module provides an API for providing Datasource connection strings.

To use this module, use "%requires DatasourceProvider" in your code.

All the public symbols in the module are defined in the DatasourceProvider namespace

Functions:

Datasource Provider Modules

This module uses the "QORE_DATASOURCE_PROVIDERS" environment variable to load datasource provider modules. Each datasource provider module must provide two public functions; one called get_mod_ds_string() with the following signature:

public string sub get_mod_ds_string(string str) {}

And one called get_mod_ds_hash() returning a hash keyed by datasource name where values are datasource strings with the following signature:

public *hash<string, string> sub get_mod_ds_hash() {}

For get_mod_ds_string(), if the string argument is not a valid identifier for a datasource, the function should throw an exception (any exception; the exception is not displayed by default).

Datasource provider modules declared in the "QORE_DATASOURCE_PROVIDERS" environment variable must be separated by the platform-specific PathSep character as in the following examples:

Unix Example
export QORE_DATASOURCE_PROVIDERS=MyDatasourceProvider:OtherDatasourceProvider
Windows CMD.EXE Example
set QORE_DATASOURCE_PROVIDERS=MyDatasourceProvider;OtherDatasourceProvider
Windows PowerShell Example
$env:QORE_DATASOURCE_PROVIDERS="MyDatasourceProvider;OtherDatasourceProvider"

Release Notes

DatasourceProvider 1.1

  • added support for the get_ds_hash() function

DatasourceProvider 1.0