ct_cmd_drop

Description

Deallocates a command handle.

Syntax

CS_RETCODE ct_cmd_drop(command);
CS_COMMAND *command;

Parameters

command

(I) Handle for this client/server operation. This handle is defined in the associated ct_cmd_alloc call. The connection handle corresponds to the TDPROC handle in the Open ServerConnect Gateway-Library.

Returns

ct_cmd_drop returns one of the following values:

Value

Meaning

CS_SUCCEED (-1)

The routine completed successfully.

CS_FAIL (-2)

The routine failed.

ct_cmd_drop returns CS_FAIL if the command handle has any results pending.

TDS_COMMAND_ACTIVE (-7)

A command is in progress.

TDS_RESULTS_STILL_ACTIVE (50)

Some results are still pending.

Examples

Example 1

The following code fragment demonstrates how ct_cmd_drop is used with other routines at the end of a program after results have been processed. It is taken from the sample program SYCTSAA6 in Appendix A, “Sample Language Application.”

/***********************************************************************/
/*                                                                     */
/* Subroutine to perform drop command handler, close server            */
/* connection, and deallocate Connection Handler.                      */
/*                                                                     */
/***********************************************************************/
  void   close_connection ()
    {
   CS_INT        rc;

/*---------------------------------------------------------------------*/
/* drop the command handle                                             */
/*---------------------------------------------------------------------*/
         rc = ct_cmd_drop (cmd);
  
         if (rc == CS_FAIL)
         {
            strncpy (msgstr, "CT_CMD_DROP failed", msg_size);
            error_out (rc) ;
         }
   /*------------------------------------------------------------------*/
  /* close the server connection                                       */
  /*-------------------------------------------------------------------*/
          rc = ct_close (connection, (long) CS_UNUSED);
  
         if (rc == CS_FAIL)
         {
            strncpy (msgstr, "CT_CLOSE failed", msg_size);
            error_out (rc) ;
         }
  /*--------------------------------------------------------------------*/
  /* De_allocate the connection handle                                  */
  /*--------------------------------------------------------------------*/
          rc = ct_con_drop (connection);
  
         if (rc == CS_FAIL)
         {
            strncpy (msgstr, "CT_CON_DROP failed", msg_size);
            error_out (rc) ;
         }
  }   /* end close_connection */

Usage

See also

Related functions