Permalink
Browse files

handle parameters for encoding 'parse'

  • Loading branch information...
1 parent 009d537 commit d1b9e28da75ee2e2d7d81cdc3d37b0623d31b7a9 @nniclausse nniclausse committed Aug 12, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/lib/pgsql_proto.erl
View
@@ -566,10 +566,12 @@ encode_message(describe, {Object, Name}) ->
encode($D, <<ObjectP:8/integer, NameP/binary>>);
encode_message(flush, _) ->
encode($H, <<>>);
-encode_message(parse, {Name, Query, _Oids}) ->
+encode_message(parse, {Name, Query, Oids}) ->
StringName = string(Name),
StringQuery = string(Query),
- encode($P, <<StringName/binary, StringQuery/binary, 0:16/integer>>);
+ NOids=length(Oids),
+ OidsBin=lists:foldl(fun(X,Acc)-> << Acc/binary ,X:32/integer>> end, << >>, Oids),
+ encode($P, <<StringName/binary, StringQuery/binary, NOids:16/integer,OidsBin/binary>>);
encode_message(bind, Bind={NamePortal, NamePrepared,
Parameters, ParamsFormats,ResultFormats}) ->
%%io:format("encode bind: ~p~n", [Bind]),

0 comments on commit d1b9e28

Please sign in to comment.