Qore ConnectionProvider Module Reference  1.2

ConnectionProvider Module Introduction

The ConnectionProvider module provides an API for providing pluggable network connections objects to Qore. This module can also be used to provide URL strings from identifiers from registered connection providers as well.

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

All the public symbols in the module are defined in the ConnectionProvider namespace.




Connection Provider Modules

This module uses the "QORE_CONNECTION_PROVIDERS" environment variable to load connection provider modules. Each connection provider module must provide two public functions with the following signatures:

# returns a ConnectionProvider::AbstractConnection object for the given identifier or throws an exception
public ConnectionProvider::AbstractConnection sub get_mod_connection(string str) {}
# returns a hash keyed by connection identifiers with values as ConnectionProvider::AbstractConnection objects for all connections known to the connection provider
public *hash sub get_mod_connections() {}

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

Unix Example
export QORE_CONNECTION_PROVIDERS=MyConnectionProvider:OtherConnectionProvider
Windows CMD.EXE Example
set QORE_CONNECTION_PROVIDERS=MyConnectionProvider;OtherConnectionProvider
Windows PowerShell Example

Release Notes

ConnectionProvider 1.2

  • the AbstractConnection::consructor() refactoring
  • all connection clases have unified constructor
  • old contructors and static make() constructors are deprecated
  • ConnectionProvider::AbstractConnection::parseUrl() is introduced
  • ConnectionProvider::AbstractConnection::getSafeurl() is not static anymore
  • it allows their reimplementation in the inherited class. It can be used to parse strange and unexpected URLs like eg. pure json strings, or Datasource connection strings.

ConnectionProvider 1.1

ConnectionProvider 1.0.1

  • removed unnecessary serialization from AbstractConnection::get() (issue 2880)

ConnectionProvider 1.0