anchor.diff:      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]).
   
  -%% == 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.
  +-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 --
   
  
positive.code: -include("internal.hrl").
  
  %% -- public --
  %% -export([stmt_close/2, stmt_execute/3, stmt_fetch/2, stmt_reset/2]).
  %% -export([next_result/1, stmt_next_result/2]).
  
  %% -- private --
  -export([connect/1, close/1, auth/1, version/1]).
  -export([ping/1, stat/1, refresh/1, select_db/1]).
  -export([query/1]).
  -export([stmt_prepare/1]).
  
  -export([binary_to_float/2,
           recv/3, recv_packed_binary/3, recv_unsigned/3]).
  
negative.code:             {error, Reason, Handle}
      end.
  
  %% -- internal: stmt_close --
  
  stmt_close_pre(#handle{}=H, #prepare{stmt_id=S}) ->
      {ok, [<<?COM_STMT_CLOSE,S:32/little>>,reset(H)]}.
  
  stmt_close_post(#handle{}=H) ->
      {ok, [H]}.
  
  
  
  %%  TODO,TODO
  
  %% == public ==
  
  %% -spec stmt_execute(protocol(),prepare(),[term()])
  %%                   -> {ok,prepare(),protocol()}|
  