Packages
tds
1.2.0
2.3.8
2.3.7
2.3.6
2.3.5
2.3.4
2.3.2
2.3.1
2.3.0
2.3.0-rc.1
2.3.0-rc.0
2.2.0
2.1.3
2.1.2
2.1.1
2.1.0
2.0.4
2.0.3
2.0.2
2.0.1
2.0.1-rc2
2.0.1-rc1
2.0.0
retired
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.0
1.0.19
1.0.18
1.0.17
1.0.16
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0
0.4.0
0.3.0
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
Microsoft SQL Server client (Elixir implementation of the MS TDS protocol)
Current section
Files
Jump to
Current section
Files
lib/tds/protocol/token.ex
defmodule Tds.Protocol.Token do
import Bitwise
# @tokens [
# {0x88, :alt_metadata},
# {0xD3, :alt_row},
# {0x81, :col_metadata},
# {0xA5, :col_info},
# {0xFD, :done},
# {0xFE, :done_proc},
# {0xFF, :done_in_proc},
# {0xE3, :env_change},
# {0xAA, :error},
# {0xAE, :feature_ext_ack},
# {0xEE, :fed_auth_info},
# {0xAB, :info},
# {0xAD, :login_ack},
# {0xD2, :nbc_row},
# {0x78, :offset},
# {0xA9, :order},
# {0x79, :return_status},
# {0xAC, :return_value},
# {0xD1, :row},
# {0xED, :sspi},
# {0xA4, :tab_name}
# ]
def class(token) when token > 0 and token <= 0xFF do
case token &&& 0b00110000 do
0b0000_0000 -> {:variable, :count}
0b0010_0000 -> {:variable, :length}
0b0001_0000 -> {:fixed, 0}
0b0011_0000 -> {:fixed, fixed_length(token)}
end
end
defp fixed_length(token) do
case token &&& 0b00001100 do
0b0000_0000 -> 1
0b0000_0100 -> 2
0b0000_1000 -> 4
0b0000_1100 -> 8
end
end
end