2.2.7.7 DONE

Token Stream Name

 DONE

Token Stream Function

Indicates the completion status of a SQL statement.

Token Stream Comments

  • The token value is 0xFD.

  • This token is used to indicate the completion of a SQL statement. Because multiple SQL statements can be sent to the server in a single SQL batch, multiple DONE tokens might be generated. In this case, all but the final DONE token will have a Status value with the DONE_MORE bit set (details follow).

  • A DONE token is returned for each SQL statement in the SQL batch, except for variable declarations.

  • For execution of SQL statements within stored procedures, DONEPROC and DONEINPROC tokens are used in place of DONE tokens.

Token Stream-Specific Rules

 TokenType        =   BYTE
 Status           =   USHORT
 CurCmd           =   USHORT
 DoneRowCount     =   LONG

Token Stream Definition

 DONE             =   TokenType
                      Status
                      CurCmd
                      DoneRowCount

Token Stream Parameter Details

Token stream parameter details are described in the following table.

Parameter

Description

TokenType

DONE_TOKEN

Status

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

  • 0x00: DONE_FINAL (this DONE is the final DONE in the request).

  • 0x1: DONE_MORE (this DONE message is not the final DONE message in the response; subsequent data streams to follow).

  • 0x2: DONE_ERROR (an error occurred on the current SQL statement).

  • 0x4: DONE_INXACT (a transaction is in progress).<5>

  • 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).

  • 0x20: DONE_ATTN (the DONE message is a server acknowledgement of a client ATTENTION message.)

  • 0x100: DONE_SRVERROR (used in place of DONE_ERROR when an error occurred on the current SQL statement that is severe enough to require the result set, if any, to be discarded).

CurCmd

The token of the current SQL statement.

DoneRowCount

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