DataProvider Module

# Introduction to the DataProvider Module

The DataProvider module provides APIs for hierarchical data structures from arbitrary sources to be described, queried, introspected, and updated. It also supports data providers with request-reply semantics such as REST schemas or with SOAP messaging.

The data provider module supports high-performance reading (searching) and writing as well as record creation and upserting and transaction management if supported by the underlying data provider implementation as well.

The Qore command-line program `qdp` provides a user-friendly interface to data provider functionality.

This module provides the following primary classes:

- AbstractDataField
- AbstractDataProcessor
- AbstractDataProvider
- AbstractDataProviderBulkOperation
- AbstractDataProviderBulkRecordInterface
- AbstractDataProviderFactory
- AbstractDataProviderRecordIterator
- DataProvider
- DataProviderBulkRecordIterator
- DataProviderPipeline
- DefaultBulkInserter
- DefaultBulkUpserter
- DefaultBulkRecordIterface
- DefaultRecordIterator
- QoreDataField

The following supporting type classes are also provided:

- AbstractDataProviderType
- DataProviderTypeCache
- HashDataType
- HashDeclDataType
- ListDataType
- NullDataProvider
- NullDataProviderFactory
- QoreBoolDataType
- QoreBoolDataTypeBase
- QoreBoolOrNothingDataType
- QoreDataType
- QoreDateDataType
- QoreDateDataTypeBase
- QoreDateOrNothingDataType
- QoreFloatDataType
- QoreFloatDataTypeBase
- QoreFloatOrNothingDataType
- QoreHashDataType
- QoreIntDataType
- QoreIntDataTypeBase
- QoreIntOrNothingDataType
- QoreListDataType
- QoreNumberDataType
- QoreNumberDataTypeBase
- QoreNumberOrNothingDataType
- QoreSoftBoolDataType
- QoreSoftBoolNoNullDataType
- QoreSoftBoolOrNothingDataType
- QoreSoftDateDataType
- QoreSoftDateNoNullDataType
- QoreSoftDateOrNothingDataType
- QoreSoftFloatDataType
- QoreSoftFloatNoNullDataType
- QoreSoftFloatOrNothingDataType
- QoreSoftIntDataType
- QoreSoftIntNoNullDataType
- QoreSoftIntOrNothingDataType
- QoreSoftNumberDataType
- QoreSoftNumberNoNullDataType
- QoreSoftNumberOrNothingDataType
- QoreSoftStringDataType
- QoreSoftStringOrNothingDataType
- QoreStringDataType
- QoreStringDataTypeBase
- QoreStringOrNothingDataType

## Data Provider Modules

This module uses the `"QORE_DATA_PROVIDERS"` environment variable to register data provider modules. Each data provider registration module must provide one of the following two public functions.

### Data Provider Dynamic Discovery

Implement a public function with the following signature to support dynamic discovery of data providers:

# returns a hash of connection provider factory names to module names
public hash<string, string> sub get_data_provider_map() { ... }

### Data Provider Type Dynamic Discovery

Implement a public function with the following signature to support dynamic discovery of data provider types:

# returns a hash of type prefix paths (ex: \c "qore/sftp") to module names
public hash<string, string> sub get_type_provider_map() { ... }

Data provider registration modules declared in the `"QORE_DATA_PROVIDERS"` environment variable must be separated by the platform-specific PathSep character as in the following examples:

Unix Example

      export QORE_DATA_PROVIDERS=MyConnectionProvider:OtherConnectionProvider

Windows CMD.EXE Example

      set QORE_DATA_PROVIDERS=MyConnectionProvider;OtherConnectionProvider

Windows PowerShell Example

      $env:QORE_DATA_PROVIDERS="MyConnectionProvider;OtherConnectionProvider"

# Release Notes

## DataProvider v1.0.2

- implemented the following classes:
  - AbstractDataProcessor
  - DataProviderBulkRecordIterator
  - DataProviderPipeline
  (issue 3876)
- added the `DUPLICATE-RECORD` exception documentation for AbstractDataProvider::createRecord()

## DataProvider v1.0.1

- implemented callbacks to allow for dynamic elements of request-response data providers (such as URI paths) to be resolved at runtime (issue 3838)
- AbstractDataProviderType and AbstractDataField classes made serializable (issue 3809)
- implemented the DataProviderTypeCache class to encapsulate reusable type caching logic (issue 3810)

## DataProvider v1.0

- initial release of the module