anchor.diff:          _ -> {error, "Can't begin transaction"}
       end.
   
  -allocate_statement(Mod, Sock, DbHandle) ->
  -    Mod:send(Sock,
  -        efirebirdsql_op:op_allocate_statement(DbHandle)),
  -    case efirebirdsql_op:get_response(Mod, Sock) of
  -        {op_response,  {ok, Handle, _}} -> {ok, Handle};
  -        _ -> {error, "Allocate statement failed"}
  -    end.
  -
  +%% prepare and free statement
   prepare_statement(Mod, Sock, TransHandle, StmtHandle, Sql) ->
       Mod:send(Sock,
           efirebirdsql_op:op_prepare_statement(TransHandle, StmtHandle, Sql)),
  
positive.code:     case efirebirdsql_op:get_response(Mod, Sock) of
          {op_response,  {ok, _, _}} -> ok;
          _ -> {error, "Rollback failed"}
      end.
  
  detach(Mod, Sock, DbHandle) ->
      Mod:send(Sock, efirebirdsql_op:op_detach(DbHandle)),
      case efirebirdsql_op:get_response(Mod, Sock) of
          {op_response,  {ok, _, _}} -> ok;
          _ -> {error, "Detach failed"}
      end.
  
  %% -- client interface --
  
negative.code:     case gen_tcp:connect(Host, Port, SockOptions) of
          {ok, Sock} ->
              {R, NewState} = connect(gen_tcp, Sock, Host, Username, Password, Database, IsCreateDB, PageSize, State),
              {reply, R, NewState#state{sock=Sock}};
          Error = {error, _} ->
              {reply, Error, State}
      end;
  