Developer Documentation Library > Data Model > Extending the UNICOM Intelligence Data Model > Creating a CDSC > Implementing the features of a CDSC > Implementing Can Select
 
Implementing Can Select
When the Provider reads data through the CDSC, it:
Calls CreateCommand on the Source object to get a Command object (unless it is reusing an existing Command object).
Adds bindings to the Command object for the required variables.
Calls MoveFirst on the Command object and retrieves the Value property from the Value objects for the required bindings.
Repeatedly calls MoveNext on the Command object and retrieves the Value property from the Value objects for the required bindings, until the Command object's EOF property is true.
Calls Close on the Command object (unless the Provider intends to reuse it later).
If backward scrolling is supported and the Provider wants to access the data in reverse order, it uses MoveLast, MovePrevious, and BOF instead of MoveFirst, MoveNext, and EOF. (For further information, see Implementing Scroll Backward.)
Modify the Source object's CreateCommand method to add any extra initialization required for your Command object. In the skeleton C++ project, change CSource::CreateCommand() to return S_OK instead of E_NOTIMPL if it succeeds.
Bindings are added using the Append method on the Command object's DataBindings collection. You can optionally modify this to add validation (for example, to check that a new column binding refers to a Table and Column that exist, and that the column is in the given table) and initialization of your own. (For further information, see Handling bindings.)
If your CDSC does not support:
HDATA. Reject any table binding (of type cdBindingTable).
Expressions. Reject any expression binding (cdBindingExpression).
Aggregation. Reject any aggregation binding (cdBindingAggregate).
Order By. You might want to reject any binding whose SortOrder property is not cdUndefined.
You might also want to disable the Append method if the Command has already started accessing the data.
If an existing Command is being reused, the Provider might call the DataBindings Delete or Clear methods to remove old bindings. You might need to modify Delete and Clear, to do any extra cleaning up required by your custom handling of bindings.
Add code to the MoveFirst method of your Command class, so that the first case of data is available in the Value objects that were bound to the command, and the Command object's EOF property is false (unless there is no data). In the C++ skeleton project, change CCommand::MoveFirst() to return S_OK instead of E_NOTIMPL if it succeeds.
You might need to add code to the Close method of your Command class, to do any cleaning up required after reading the data.
See also
Handling hierarchical data
CDSC interface
Activation diagram for SELECT statement
Implementing the features of a CDSC