New token description (0x81 Compute Format description)

Scott C. Gray gray at voicenet.com
Thu Aug 10 13:35:38 EDT 2000


On Thu, 10 Aug 2000, Scott C. Gray wrote:

> 
> I lost the owner and URL of the person keeping track of the
> latest TDS specifications, but I have one to add that I have
> been hacking on.
> 
> This is the TDS 7.0 compute format (136/0x81) description column:

Sorry, I was a little hasty...the following seems a bit more
correct...

+------+---+---+--------+----+----+  +----+---+
| 136  | #cols | compid | #bycols |..| bycol# |...
+------+---+---+--------+----+----+  +----+---+
                                         ^
                                         +--- Repeat for each BY column

                   Repeat for each compute column
    +--------+---+---+----+-----+--+--+------+-----+------+---------+
    | optype | opcol | usertype | ??? | type | len | ?len | ??????? |
    +--------+---+---+----+-----+--+--+------+-----+------+---------+

    #cols:    Number of columns in compute result
    compid:   id number of compute clause. Each compute clause in your
              select statement has an increasing id number.
    #bycols:  Number of columns in the BY clause
    bycol#:   Column # of column in BY clause. This is repeated #bycols
              times in data stream
    optype:   75 = COUNT(*)
              77 = SUM(...)
              79 = AVG(...)
              81 = MIN(...)
              82 = MAX(...)
    opcol:    column being computed
    usertype: user type number
    unknown:  2 unknown bytes [ 0x01 0x00 ]
    type:     TDS datatype
    len:      maxlength of datatype. The size of this fields varies
              upon the datatype between 0 and 4 bytes.
    ?len:     one byte indicating length of following data
    ??????:   Unknown data (suspect it may have something to do with locale?)

-scott

--
Scott C. Gray <gray at voicenet.com>     "my keybard is brken"
       http://www.voicenet.com/~gray/sqsh.html




More information about the FreeTDS mailing list