Skip to content

Commit 55ec02c

Browse files
author
Simon Thörnqvist
committed
delimit column metadata and row data
1 parent b663074 commit 55ec02c

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
@@ -985,21 +985,23 @@ defmodule Tds.Types do
985985
column_length = <<length(columns) :: little-unsigned-16>>
986986
{column_attrs, column_meta} = Enum.reduce(columns, {[], <<>>}, fn (%Parameter{} = param, {attrs, acc_bin}) ->
987987
{bin_type, data, attr} = encode_data_type(param)
988-
bin = acc_bin <> <<0x00 :: little-unsigned-32, 0x00 :: little-unsigned-16 >> <> data <> <<0, 0>>
988+
bin = acc_bin <> <<0x00 :: little-unsigned-32, 0x00 :: little-unsigned-16 >> <> data <> <<0x00>>
989989

990990
{[{bin_type, attr} | attrs], bin}
991991
end)
992992

993993
row_data = Enum.reduce(rows, <<>>, fn (params, row_acc) ->
994994
row_bin = column_attrs
995+
|> Enum.reverse
995996
|> Enum.zip(params)
996997
|> Enum.reduce(<<>>, fn ({{type, attr}, param}, acc) ->
997998
acc <> encode_data(type, param, attr)
998999
end)
1000+
9991001
row_acc <> << 0x01 >> <> row_bin
10001002
end)
10011003

1002-
column_length <> column_meta <> row_data <> <<0x00>>
1004+
column_length <> column_meta <> <<0x00>> <> row_data <> <<0x00>>
10031005
end
10041006

10051007
@doc """

0 commit comments

Comments
 (0)