Chapter 1. Design and Implementation

Why the provider exists, and what it does

Table of Contents
Independent and Dependent Layers
Provider Classes
Why the provider exists, and what it does

Independent and Dependent Layers

The dbstreams library is really two layers: the database-independent part, and the database-dependent part.

The independent part is the stream layer. It defines the public interface used by applications. It has no knowledge of what kind of server or native library is used to communicate with the server. The stream layer concentrates instead on implementing the stream metaphor.

The provider layer is database-dependent. It "generifies" the native database library, providing a uniform interface for use by dbstreams.

What does "generify" mean? It means to create a uniform way to:

"Generification" features

Easier said than done. Server implementations and native client libraries vary in the way the define users, databases, datatypes, and errors. Certainly the primary challenge in the design of the provider interface is define all those things uniformly, such that no information is lost and no idiosyncrasies are passed.

Before a dbstream can be used (and normally at construction) the application passes a token (of type provider_type) designating the provider to be used. [1] The dbstream class instantiates the appropriate provider, storing its address in provider *pprovider. All providers are derived from provider, which defines storage for some member variables and defines the calling interface as a set of pure virtual functions.

Terminology

Terms used in this document

Stream Layer

The public, database-independent classes, used by the application.

Provider

The abstract provider class or one of its concrete implementations.

Driver, Native Library

The C-callable library that is used to communicate with the database server.

Notes

[1]

This is unfortunately necessary because there is no way to interrogate the server about its implementation, no way to know from the outside whether we're talking to, say, an Oracle or Postgres server.