Browse Source

incomplete execute_batch results handling

Anton Lebedevich 13 years ago
parent
commit
c177d18696
1 changed files with 10 additions and 2 deletions
  1. 10 2
      src/pgsql_sock.erl

+ 10 - 2
src/pgsql_sock.erl

@@ -509,7 +509,9 @@ on_message({$2, <<>>}, State) ->
                      %% TODO send Describe as a part of equery, needs text format support
                      %% TODO send Describe as a part of equery, needs text format support
                      notify(State, {columns, get_columns(State)});
                      notify(State, {columns, get_columns(State)});
                  bind ->
                  bind ->
-                     finish(State, ok)
+                     finish(State, ok);
+                 execute_batch ->
+                     State
              end,
              end,
     {noreply, State2};
     {noreply, State2};
 
 
@@ -548,6 +550,12 @@ on_message({$C, Bin}, State) ->
                      finish(State, Notice, {ok, Count, Rows});
                      finish(State, Notice, {ok, Count, Rows});
                  {execute, _, _} ->
                  {execute, _, _} ->
                      finish(State, Notice, {ok, Rows});
                      finish(State, Notice, {ok, Rows});
+                 {execute_batch, {_, Count}, []} ->
+                     add_result(State, Notice, {ok, Count});
+                 {execute_batch, {_, Count}, _} ->
+                     add_result(State, Notice, {ok, Count, Rows});
+                 {execute_batch, _, _} ->
+                     add_result(State, Notice, {ok, Rows});
                  {C, {_, Count}, []} when C == squery; C == equery ->
                  {C, {_, Count}, []} when C == squery; C == equery ->
                      add_result(State, Notice, {ok, Count});
                      add_result(State, Notice, {ok, Count});
                  {C, {_, Count}, _} when C == squery; C == equery ->
                  {C, {_, Count}, _} when C == squery; C == equery ->
@@ -571,7 +579,7 @@ on_message({$I, _Bin}, State) ->
 %% ReadyForQuery
 %% ReadyForQuery
 on_message({$Z, <<Status:8>>}, State) ->
 on_message({$Z, <<Status:8>>}, State) ->
     State2 = case command_tag(State) of
     State2 = case command_tag(State) of
-                 squery ->
+                 C when C == squery; C == execute_batch ->
                      case State#state.results of
                      case State#state.results of
                          [Result] ->
                          [Result] ->
                              finish(State, done, Result);
                              finish(State, done, Result);