@@ -582,7 +582,7 @@ defmodule Tds.Types do
582582
583583 def encode_tvp_type ( % Parameter { } ) do
584584 type = @ tds_data_type_tvp
585- data = << type >> <> << 0 , 0 >> <> << 0 , 0 >> <> << 0 , 0 >>
585+ data = << type >> <> << 0 , 0 , 0 >>
586586 { type , data , [ ] }
587587 end
588588
@@ -982,7 +982,7 @@ defmodule Tds.Types do
982982 @ doc """
983983 Data Encoding TVP type
984984 """
985- def encode_data ( @ tds_data_type_tvp , value , _attrs ) when is_nil ( value ) ,
985+ def encode_data ( @ tds_data_type_tvp , % { columns: nil } , _attrs ) ,
986986 do: << 0xFF :: little - unsigned - 16 , 0x00 , 0x00 >>
987987
988988 def encode_data ( @ tds_data_type_tvp , % { columns: columns , rows: rows } , _attrs ) do
@@ -994,16 +994,16 @@ defmodule Tds.Types do
994994 { [ { bin_type , attr } | attrs ] , bin }
995995 end )
996996
997- row_data = Enum . reduce ( rows , << >> , fn params ->
998- column_attrs
997+ row_data = Enum . reduce ( rows , << >> , fn ( params , row_acc ) ->
998+ row_bin = column_attrs
999999 |> Enum . zip ( params )
10001000 |> Enum . reduce ( << >> , fn ( { { type , attr } , param } , acc ) ->
1001- acc <> encode_data ( type , param , attr )
1001+ foo = acc <> encode_data ( type , param , attr )
10021002 end )
1003- << 0x01 >> <> column_attrs
1003+ row_acc <> << 0x01 >> <> row_bin
10041004 end )
10051005
1006- column_length <> column_meta <> << 0x00 >> <> row_data <> << 0x00 >>
1006+ column_length <> column_meta <> row_data <> << 0x00 >>
10071007 end
10081008
10091009 @ doc """
0 commit comments