แก้ไข

แชร์ผ่าน


CManualAccessor Class

Represents an accessor type designed for advanced use.

Syntax

class CManualAccessor : public CAccessorBase

Requirements

Header: atldbcli.h

Members

Methods

Name Description
AddBindEntry Adds a bind entry to the output columns.
AddParameterEntry Adds a parameter entry to the parameter accessor.
CreateAccessor Allocates memory for the column bind structures and initializes the column data members.
CreateParameterAccessor Allocates memory for the parameter bind structures and initializes the parameter data members.

Remarks

Using CManualAccessor, you can specify the parameter and output column binding by run-time function calls.

CManualAccessor::AddBindEntry

Adds a bind entry to the output columns.

Syntax

void AddBindEntry(DBORDINAL nOrdinal,
   DBTYPE wType,  DBLENGTH nColumnSize,
   void* pData,
   void* pLength = NULL,
   void* pStatus = NULL) throw ();

Parameters

See DBBINDING in the OLE DB Programmer's Reference.

nOrdinal
[in] Column number.

wType
[in] Data type.

nColumnSize
[in] Column size in bytes.

pData
[in] A pointer to the column data stored in the buffer.

pLength
[in] A pointer to the field length, if required.

pStatus
[in] A pointer to the variable to be bound to the column status, if required.

Remarks

To use this function, you must first call CreateAccessor. You cannot add more entries than the number of columns specified in CreateAccessor.

CManualAccessor::AddParameterEntry

Adds a parameter entry to the parameter entry structures.

Syntax

void AddParameterEntry(DBORDINAL nOrdinal,
   DBTYPE wType,  DBLENGTH nColumnSize,
   void* pData,
   void* pLength = NULL,
   void* pStatus = NULL,
   DBPARAMIO eParamIO = DBPARAMIO_INPUT) throw ();

Parameters

See DBBINDING in the OLE DB Programmer's Reference.

nOrdinal
[in] Parameter number.

wType
[in] Data type.

nColumnSize
[in] Column size in bytes.

pData
[in] A pointer to the column data stored in the buffer.

pLength
[in] A pointer to the field length, if required.

pStatus
[in] A pointer to the variable to be bound to the column status, if required.

eParamIO
[in] Specifies whether the parameter with which the binding is associated is an input, input/output, or output parameter.

Remarks

To use this function, you must first call CreateParameterAccessor.

CManualAccessor::CreateAccessor

Allocates memory for the column bind structures and initializes the column data members.

Syntax

HRESULT CreateAccessor(int nBindEntries,
  void* pBuffer,
   DBLENGTH nBufferSize) throw();

Parameters

nBindEntries
[in] Number of columns. This number should match the number of calls to the CManualAccessor::AddBindEntry function.

pBuffer
[in] A pointer to the buffer where the output columns are stored.

nBufferSize
[in] The size of the buffer in bytes.

Return Value

One of the standard HRESULT values.

Remarks

Call this function before you call the CManualAccessor::AddBindEntry function.

CManualAccessor::CreateParameterAccessor

Allocates memory for the parameter bind structures and initializes the parameter data members.

Syntax

HRESULT CreateParameterAccessor(int nBindEntries,
   void* pBuffer,
   DBLENGTH nBufferSize) throw();

Parameters

nBindEntries
[in] Number of columns.

pBuffer
[in] A pointer to the buffer where the input columns are stored.

nBufferSize
[in] The size of the buffer in bytes.

Return Value

One of the standard HRESULT values.

Remarks

You must call this function before calling AddParameterEntry.

See also

DBViewer
OLE DB Consumer Templates
OLE DB Consumer Templates Reference
CAccessor Class
CDynamicAccessor Class
CDynamicParameterAccessor Class