How Do I Handle a Command I Know Nothing About?
There are four things to do when handling an unknown command: determine the parameters, execute the command, determine the output columns, and see if there are multiple return rowsets. To do this with the OLE DB Consumer Templates, use the CManualAccessor class and follow these steps:
Open a CCommand object with CManualAccessor as a template parameter.
CCommand<CManualAccessor, CRowset, CMultipleResults> rs;
Query the session for the IDBSchemaRowset interface and use the procedure parameters rowset. If the IDBSchemaRowset interface is not available, query for the ICommandWithParameters interface. Call GetParameterInfo for information. If neither interface is available, you can assume there are no parameters.
For each of the parameters, call AddParameterEntry to add the parameters and set them.
Open the rowset but set the bind parameter to false.
Call GetColumnInfo to retrieve the output columns. Use AddBindEntry to add the output column to the binding.
Call GetNextResult to determine if more rowsets are available. Repeat steps 2 through 5.
See CDBListView::CallProcedure in the sample for an example.