| description | Learn more about: ICommandImpl Class | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| title | ICommandImpl Class | ||||||||||||||||||||||||||||||||||||
| ms.date | 11/04/2016 | ||||||||||||||||||||||||||||||||||||
| f1_keywords |
|
||||||||||||||||||||||||||||||||||||
| helpviewer_keywords |
|
||||||||||||||||||||||||||||||||||||
| ms.assetid | ef285fef-0d66-45e6-a762-b03357098e3b |
Provides implementation for the ICommand interface.
template <class T, class CommandBase = ICommand>
class ATL_NO_VTABLE ICommandImpl : public CommandBaseT
Your class, derived from ICommandImpl.
CommandBase
A command interface. The default is ICommand.
Header: atldb.h
| Name | Description |
|---|---|
| Cancel | Cancels the current command execution. |
| CancelExecution | Cancels the current command execution. |
| CreateRowset | Creates a rowset object. |
| Execute | Executes the command. |
| GetDBSession | Returns an interface pointer to the session that created the command. |
| ICommandImpl | The constructor. |
| Name | Description |
|---|---|
| m_bCancel | Indicates whether the command is to be canceled. |
| m_bCancelWhenExecuting | Indicates whether the command is to be canceled when executing. |
| m_bIsExecuting | Indicates whether the command is currently executing. |
A mandatory interface on the command object.
Cancels the current command execution.
STDMETHOD(Cancel)();See ICommand::Cancel in the OLE DB Programmer's Reference.
Cancels the current command execution.
HRESULT CancelExecution();Called by Execute to create a single rowset.
template template <class RowsetClass>
HRESULT CreateRowset(IUnknown* pUnkOuter,
REFIID riid,
DBPARAMS* pParams,
DBROWCOUNT* pcRowsAffected,
IUnknown** ppRowset,
RowsetClass*& pRowsetObj);RowsetClass
A template class member representing the user's rowset class. Usually generated by the wizard.
pUnkOuter
[in] A pointer to the controlling IUnknown interface if the rowset is being created as part of an aggregate; otherwise, it is null.
riid
[in] Corresponds to riid in ICommand::Execute.
pParams
[in/out] Corresponds to pParams in ICommand::Execute.
pcRowsAffected
Corresponds to pcRowsAffected in ICommand::Execute.
ppRowset
[in/out] Corresponds to ppRowset in ICommand::Execute.
pRowsetObj
[out] A pointer to a rowset object. Typically this parameter is not used, but it can be used if you must perform more work on the rowset before passing it to a COM object. The lifetime of pRowsetObj is bound by ppRowset.
A standard HRESULT value. See ICommand::Execute for a list of typical values.
To create more than one rowset, or to provide your own conditions for creating different rowsets, place different calls to CreateRowset from within Execute.
See ICommand::Execute in the OLE DB Programmer's Reference.
Executes the command.
HRESULT Execute(IUnknown* pUnkOuter,
REFIID riid,
DBPARAMS* pParams,
DBROWCOUNT* pcRowsAffected,
IUnknown** ppRowset);See ICommand::Execute in the OLE DB Programmer's Reference.
The outgoing interface requested will be an interface acquired from the rowset object that this function creates.
Execute calls CreateRowset. Override the default implementation to create more than one rowset or to provide your own conditions for creating different rowsets.
Returns an interface pointer to the session that created the command.
STDMETHOD (GetDBSession) (REFIID riid,
IUnknown** ppSession);See ICommand::GetDBSession in the OLE DB Programmer's Reference.
Useful for retrieving properties from the session.
The constructor.
ICommandImpl();Indicates whether the command is canceled.
unsigned m_bCancel:1;You can retrieve this variable in the Execute method of your command class and cancel as appropriate.
Indicates whether the command can be canceled when executing.
unsigned m_bCancelWhenExecuting:1;Defaults to true (can be canceled).
Indicates whether the command is currently executing.
unsigned m_bIsExecuting:1;The Execute method of your command class can set this variable to true.
OLE DB Provider Templates
OLE DB Provider Template Architecture