CParamBase Class Overview

class CParamBase : virtual public CCmndBase

        CParamBase is designed for the dynamic handle of a SQL statement or stored procedure with a set (1, 2, 3, ......) of parameters. A parameter type can be one of input, output or input/output.

        Internally, a CParamBase automatically sets a set of parameter information data, and automatically creates an array of DBBINDING structures and an accessor according to a set of given CPInfo structures. If the input parameter data type in a CPInfo structure is not in agreement with its data source parameter data type, a CParamBase object will automatically force an OLEDB provider to convert the input data into the data acceptable. This implementation may fail for very few providers which don't have a good capability of doing data conversion in command, but it usually gives the best convenience for a caller because a caller doesn't have to do data conversion at a client side. Additionally, it avoids calling ICommandWithParameters::GetParameterInfo, which is an expensive call. 

        If an input parameter type is DBPARAMIO_OUTPUT or DBPARAMIO_INPUT|DBPARAMIO_OUTPUT, a CParamBase object automatically copies the returned data from a stored procedure to a client allocated buffer available. Therefore, it reduces client codes and adds both simplicity and convenience to a developer. It is notified that a developer may need to free memories for some data types. For details about this responsibility, see the overview of structure CPData.

        CParamBase is a base class of templates CBatchParam<T> and CBulkRecordParam<T> and lays a foundation for the two templates which are very efficient to handle all kinds of parameterized statements and stored procedures with great simplicity and convenience.

        CParamBase supports BLOB parameter data as either in-memory data or storage objects. If a parameterized statement or stored procedure has two or more BLOB parameter data under an extreme case, you may use BLOB parameter as in-memory data as shown in the example BLOBs. Because most of OLEDB providers don't support multiple BLOB objects, it is not possible to open a parameterized statement or stored procedure with multiple parameters with the data type DBTYPE_IUNKNOWN.

        Usually, a developer shouldn't directly create a CParamBase object.

CParamBase Class Members