2.2.7.8 DONEPROC

Token Stream Name:

 DONEPROC

Token Stream Function:

Indicates the completion status of a stored procedure. This is also generated for stored procedures executed through SQL statements.

Token Stream Comments:

  • The token value is 0xFE.

  • A DONEPROC token is sent when all the SQL statements within a stored procedure have been executed.

  • A DONEPROC token can be followed by another DONEPROC token or a DONEINPROC only if the DONE_MORE bit is set in the Status value.

  • There is a separate DONEPROC token sent for each stored procedure called.

Token Stream-Specific Rules:

 TokenType        =   BYTE
 Status           =   USHORT
 CurCmd           =   USHORT
 DoneRowCount     =   LONG / ULONGLONG;  (Changed to ULONGLONG in TDS 7.2)

The type of the DoneRowCount element depends on the version of TDS.

Token Stream Definition:

 DONEPROC         =   TokenType
                      Status
                      CurCmd
                      DoneRowCount

Token Stream Parameter Details:

 Parameter

 Description

TokenType

DONEPROC_TOKEN

Status

The Status field MUST be a bitwise 'OR' of the following:

  • 0x00: DONE_FINAL. This DONEPROC is the final DONEPROC in the request.

  • 0x1: DONE_MORE. This DONEPROC message is not the final DONEPROC message in the response; more data streams are to follow.

  • 0x2: DONE_ERROR. An error occurred on the current stored procedure. A preceding ERROR token SHOULD be sent when this bit is set.

  • 0x4: DONE_INXACT. A transaction is in progress.<47>

  • 0x10: DONE_COUNT. The DoneRowCount value is valid. This is used to distinguish between a valid value of 0 for DoneRowCount or just an initialized variable.

  • 0x80: DONE_RPCINBATCH. This DONEPROC message is associated with an RPC within a set of batched RPCs. This flag is not set on the last RPC in the RPC batch.

  • 0x100: DONE_SRVERROR. Used in place of DONE_ERROR when an error occurred on the current stored procedure, which is severe enough to require the result set, if any, to be discarded.

CurCmd

The token of the SQL statement for executing stored procedures. The token value is provided and controlled by the application layer, which utilizes TDS. The TDS layer does not evaluate the value.

DoneRowCount

The count of rows that were affected by the command. The value of DoneRowCount is valid if the value of Status includes DONE_COUNT.