Partager via


Command Objects

In the Rowset programming model, the command programming task is represented by the command object. A command object is a container for a text or stream command.

In OLE DB, a text command is a string to be passed from a consumer to a provider's data source object for execution by the provider's underlying data store. Most commonly, the text command is an SQL SELECT statement. If the text command is an SQL SELECT statement, the command object becomes a factory for a rowset. (A single session object may be able to create multiple commands.) A command object holds a text command and any command properties to be requested from the provider. Command properties are properties that either control execution of the command or, if executing the command causes a rowset to be created, affect the behavior of the resulting rowset.

Commands are requests to the underlying data store to insert, retrieve, modify, delete, or otherwise manipulate data or structure in the data store. For example, a command to retrieve all the data in a table of a relational database might be an SQL statement such as the following:

"SELECT * FROM table_name".

The results of a command that retrieves data are stored in a cache. A command object may contain multiple commands that will return multiple results. Commands may be expressed as text or as a stream, and results may be expressed as a rowset or as a stream.

Command objects expose various interfaces representing different areas of functionality of a query processor, including query formulation, preparation, and execution. For example, if a command object exposes the ICommandWithParameters interface, the command object can support dynamic parameters in addition to a text command and command properties.

For more information, see Commands.