anchor.diff:  %%         {error, Reason, Protocol} ->
   %%             {error, Reason, Protocol}
   %%     end.
  +
  +%% == internal ==
  +
  +binary_to_float(Binary, _Decimals) ->
  +    try binary_to_float(Binary)
  +    catch
  +        _:_ ->
  +            try binary_to_integer(Binary) of
  +                I ->
  +                    I * 1.0
  +            catch
  +                _:_ ->
  +                    undefined % for v5.1 (out_of_range)
  +            end
  +    end.
  +
  +binary_to_version(Binary) ->
  +    F = fun(E) -> try binary_to_integer(E,10) catch _:_ -> E end end,
  +    L = binary:split(<<Binary/binary,".0.0">>, [<<$.>>,<<$->>], [global]),
  +    lists:map(F, lists:sublist(L,3)).
  +
  +loop(Args, []) ->
  +    list_to_tuple([ok|Args]);
  +loop(Args, [H|T]) ->
  +    try apply(H, Args) of
  +        {ok, List} ->
  +            loop(List, T);
  +        {error, Reason} ->                      % connect_pre/4, recv_reason/3
  +            {error, Reason}
  +    catch
  +        {error, Reason, Handle} ->              % recv/3
  +            {error, Reason, Handle}
  +    end.
  +
  +recv(Term, Caps, #handle{}=S) ->
  +    case myer_handle:recv(S, Term, ?IS_SET(Caps,?CLIENT_COMPRESS)) of
  +        {ok, Binary, Handle} ->
  +            {ok, Binary, Handle};
  +        {error, Reason} ->
  +            throw({error,Reason,S})
  +    end.
  +
  +%%recv_fields_func(Caps) % TODO
  +%%  when ?IS_SET(Caps,?CLIENT_PROTOCOL_41) ->
  +%%    fun myer_protocol_text:recv_field_41/3;
  +recv_fields_func(_Caps) ->
  +    fun myer_protocol_text:recv_field/3.
  +
  +recv_fields_length(Byte, Caps, #handle{}=S) ->
  +    case recv_packed_unsigned(Byte, Caps, S) of
  +        {ok, U, Handle} ->
  +            {ok, [U,Handle]}
  +    end.
  +
  +recv_fields(U, #handle{caps=C}=S) -> % < loop
  +    case recv_until_eof(recv_fields_func(S), [], [], C, S) of
  +        {ok, [_Result,Fields,Handle]} when U == length(Fields) ->
  +            {ok, [Fields,Handle]}
  +    end.
  +
  +recv_packed_binary(Byte, Caps, #handle{}=S) ->
  +    case recv_packed_unsigned(Byte, Caps, S) of
  +        {ok, null, Handle} ->
  +            {ok, null, Handle};
  +        {ok, 0, Handle} ->
  +            {ok, <<>>, Handle};
  +        {ok, Length, Handle} ->
  +            recv(Length, Caps, Handle)
  +    end.
  +
  +recv_packed_unsigned(Caps, #handle{}=S) ->
  +    case recv(1, Caps, S) of
  +        {ok, Byte, Handle} ->
  +            recv_packed_unsigned(Byte, Caps, Handle)
  +    end.
  +
  +recv_packed_unsigned(undefined, Caps, Handle) -> recv_packed_unsigned(Caps, Handle);
  +recv_packed_unsigned(<<254>>,   Caps, Handle) -> recv_unsigned(8, Caps, Handle);
  +recv_packed_unsigned(<<253>>,   Caps, Handle) -> recv_unsigned(3, Caps, Handle);
  +recv_packed_unsigned(<<252>>,   Caps, Handle) -> recv_unsigned(2, Caps, Handle);
  +recv_packed_unsigned(<<251>>,  _Caps, Handle) -> {ok, null, Handle};
  +recv_packed_unsigned(<<Int>>,  _Caps, Handle) -> {ok, Int, Handle}.
  +
  +recv_remains(Byte, Caps, #handle{}=S) ->
  +    case recv(remains(S), Caps, S) of
  +        {ok, Binary, Handle} ->
  +            {ok, [<<Byte/binary,Binary/binary>>,Handle]}
  +    end.
  +
  +recv_result(#handle{caps=C}=S) -> % < loop
  +    case recv(1, C, S) of
  +        {ok, <<0>>, Handle} ->
  +            recv_result(#result{}, C, Handle);
  +        {ok, <<255>>, Handle} ->
  +            recv_reason(#reason{}, C, Handle)
  +    end.
  +
  +recv_rows(Fields, #handle{caps=C}=S) -> % < loop
  +    case recv_until_eof(fun myer_protocol_text:recv_row/4, [Fields], [], C, S) of
  +        {ok, [Result,Rows,Handle]} ->
  +            {ok, [Fields,Rows,Result,Handle]}
  +    end.
  +
  +recv_unsigned(Length, Caps, #handle{}=S) ->
  +    case recv(Length, Caps, S) of
  +        {ok, Binary, Handle} ->
  +            {ok, binary:decode_unsigned(Binary,little), Handle}
  +    end.
  +
  +recv_until_eof(Func, Args, List, Caps, #handle{}=S) ->
  +    case recv(1, Caps, S) of
  +        {ok, <<254>>, Handle} ->
  +            recv_eof(#result{}, lists:reverse(List), Caps, Handle);
  +        {ok, <<255>>, Handle} ->
  +            recv_reason(#reason{}, Caps, Handle);
  +        {ok, Byte, Handle} ->
  +            recv_until_eof(Func, Args, List, Byte, Caps, Handle)
  +    end.
  +
  +recv_until_eof(Func, Args, List, Byte, Caps, #handle{}=S) ->
  +    case apply(Func, [S|[Caps|[Byte|Args]]]) of
  +        {ok, Term, Handle} ->
  +            recv_until_eof(Func, Args, [Term|List], Caps, Handle)
  +    end.
  +
  +remains(Handle) ->
  +    myer_handle:remains(Handle).
  +
  +reset(Handle) ->
  +    myer_handle:reset(Handle).
  +
  +send(Binary, #handle{caps=C}=S) ->
  +    case myer_handle:send(S, Binary, ?IS_SET(C,?CLIENT_COMPRESS)) of
  +        {ok, Handle} ->
  +            {ok, [Handle]};
  +        {error, Reason} ->
  +            {error, Reason}
  +    end.
  +
  +send(Term, Binary, #handle{caps=C}=S) ->
  +    case myer_handle:send(S, Binary, ?IS_SET(C,?CLIENT_COMPRESS)) of
  +        {ok, Handle} ->
  +            {ok, [Term,Handle]};
  +        {error, Reason} ->
  +            {error, Reason}
  +    end.
   
   %% -----------------------------------------------------------------------------
   %% << include/mysql_com.h : CLIENT_ALL_FLAGS
  
positive.code: 
  %% next_result_pre(#protocol{}=P) ->
  %%     {ok, [reset(P)]}.
  
  %% -- internal: loop,stmt_close --
  
  %% stmt_close_pre(#prepare{stmt_id=S}=X, #protocol{}=P) ->
  %%     {ok, [X,<<?COM_STMT_CLOSE,S:32/little>>,reset(P)]}.
  
  %% stmt_close_post(_Prepare, #protocol{}=P) ->
  %%     {ok, [P]}.
  
  %% -- internal: loop,stmt_execute --
  
  
negative.code:     loop(Args, [fun stmt_prepare_pre/2, fun send/2, fun stmt_prepare_post/1,
                  fun stmt_prepare_recv_params/2, fun stmt_prepare_recv_fields/2]).
  
  -spec stmt_close([term()]) -> {ok,handle()}|{error,_,handle()}.
  stmt_close(Args) ->
      loop(Args, [fun stmt_close_pre/2, fun send/2, fun stmt_close_post/1]).
  
  %% -- internal: connect --
  
  