Execute Connect:Direct Commands

Command Group classes execute Connect:Direct® commands against Connect:Direct nodes.

Class Description
CDCommand

The base class for all Connect:Direct command objects. It wraps the parser within a class and enables methods for data manipulation. Each derived class provides an Execute() method to execute the command and return the resulting data or object.

If the result is several items, the command object returns a iterator object that holds the data. The following CDCommand class definition shows the type of methods available in this class:
Class
 CDCommand
 {
    public: 
    // Constructor for CDCommand
      CDCommand(LPCTSTR pCommand=NULL);
      virtual ~CDCommand();
      virtual void ClearParms();
      void SetCommand(const CString& strCmd);
      virtual CString GetCommand() const;
      virtual CString GetKQC() const;
     // Execute() methods are provided by each
     // derived command class.
CDSelectStatCmd Derived from the CDCommand base class, it enables you to set the SELECT STATISTICS parameters. When you call the Execute() method, an iterator data object is dynamically created and attached to the connection assigned by the CDNode object to execute the command.
CDSelectProcCmd

Derived from the CDCommand base class, it enables you to set the SELECT PROCESS parameters. When you call the Execute() method, the CDProcIterator object is created dynamically and attached to the connection assigned to execute the command.

The following example demonstrates the CDSelectProcCmd class:
 CDSelectProcCmd cmd;
 CDProcIterator it = node.Execute(cmd);
 while (it.HasMore()) { 
     CDProcess proc = it.GetNext(); 
     // use the process }
CDChangeProcCmd Derived from the CDCommand base class, it enables you to set the CHANGE PROCESS parameters. When the Execute() method is called, an iterator data object is dynamically created and attached to the connection assigned to execute the command. A CDProcIterator is attached to the iterator data and returned from the Execute() method.
CDDeleteProcCmd Derived from the CDCommand base class, it enables you to set the DELETE PROCESS parameters. When the Execute() method is called, a CDProcData object is dynamically created and attached to the connection assigned to execute the command. A CDProcIterator is attached to the iterator data and returned from the Execute() method.
CDSelectMsgCmd Derived from the CDCommand base class, it enables you to set the SELECT MESSAGE parameters. When you call the Execute() method, the command is executed and the resulting message text is stored in the internal CDMessage object
CDStopCmd Derived from the CDCommand base class, it enables you to set the STOP parameter. When you call the Execute() method, the command is executed.
CDSubmitCmd Used for submitting a Process object for execution on a node. It enables you to set the options of the SUBMIT command and then execute the command on a node. When you call the Execute() method, a CDProcess object is dynamically created and attached to the connection assigned to execute the command. The following example demonstrates the CDSubmitCmd class:
 .
 .
 .
 CDSubmitCmd cmd;
 cmd.SetFile ("myproc.cdp");
 CDProcess proc = node.Execute(cmd);
 proc.WaitForCompletion();
 .
 .
 .
CDTraceOnCmd Derived from the CDCommand base class, it enables you to set and retrieve trace options from the Connect:Direct node. The TraceOnCmd class handles all the options available from the TRACEON command. The Execute() method returns a CDTrace object that contains the current trace state.
CDTraceOffCmd Derived from the CDCommand base class, it enables you to clear trace options from the Connect:Direct node. The CDTraceOffCmd class handles all of the options available from the TRACEOFF command. You call methods to clear the desired trace parameters and then call the Execute() method. The Execute() method returns a CDTrace object that contains the current trace state.