Skip to content

Commit ae19823

Browse files
author
Simon Thörnqvist
committed
delimit column metadata and row data
1 parent e6144a3 commit ae19823

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/tds/types.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,21 +989,23 @@ defmodule Tds.Types do
989989
column_length = <<length(columns) :: little-unsigned-16>>
990990
{column_attrs, column_meta} = Enum.reduce(columns, {[], <<>>}, fn (%Parameter{} = param, {attrs, acc_bin}) ->
991991
{bin_type, data, attr} = encode_data_type(param)
992-
bin = acc_bin <> <<0x00 :: little-unsigned-32, 0x00 :: little-unsigned-16 >> <> data <> <<0, 0>>
992+
bin = acc_bin <> <<0x00 :: little-unsigned-32, 0x00 :: little-unsigned-16 >> <> data <> <<0x00>>
993993

994994
{[{bin_type, attr} | attrs], bin}
995995
end)
996996

997997
row_data = Enum.reduce(rows, <<>>, fn (params, row_acc) ->
998998
row_bin = column_attrs
999+
|> Enum.reverse
9991000
|> Enum.zip(params)
10001001
|> Enum.reduce(<<>>, fn ({{type, attr}, param}, acc) ->
10011002
acc <> encode_data(type, param, attr)
10021003
end)
1004+
10031005
row_acc <> << 0x01 >> <> row_bin
10041006
end)
10051007

1006-
column_length <> column_meta <> row_data <> <<0x00>>
1008+
column_length <> column_meta <> <<0x00>> <> row_data <> <<0x00>>
10071009
end
10081010

10091011
@doc """

0 commit comments

Comments
 (0)