25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Fix case clause

This commit is contained in:
Evgeniy Khramtsov 2014-07-09 18:02:13 +04:00
parent c15dc01cff
commit 538d4ffbd0

View File

@ -92,7 +92,7 @@ put(Rec, IndexInfo) ->
case put_raw(Table, Key, Value, SecIdxs) of case put_raw(Table, Key, Value, SecIdxs) of
ok -> ok ->
ok; ok;
Error -> {error, _} = Error ->
log_error(Error, put, [{record, Rec}, log_error(Error, put, [{record, Rec},
{index_info, IndexInfo}]), {index_info, IndexInfo}]),
Error Error
@ -135,6 +135,8 @@ get(Table) ->
[Term] [Term]
end end
end, Objs)}; end, Objs)};
{ok, []} ->
{ok, []};
{error, notfound} -> {error, notfound} ->
{ok, []}; {ok, []};
{error, _} = Error -> {error, _} = Error ->
@ -154,7 +156,7 @@ get(Table, Key) ->
Term -> Term ->
{ok, Term} {ok, Term}
end; end;
Error -> {error, _} = Error ->
log_error(Error, get, [{table, Table}, log_error(Error, get, [{table, Table},
{key, Key}]), {key, Key}]),
Error Error
@ -182,7 +184,7 @@ get_by_index(Table, Index, Key) ->
end, Vals)}; end, Vals)};
{error, notfound} -> {error, notfound} ->
{ok, []}; {ok, []};
Error -> {error, _} = Error ->
log_error(Error, get_by_index, log_error(Error, get_by_index,
[{table, Table}, [{table, Table},
{index, Index}, {index, Index},
@ -215,7 +217,7 @@ get_by_index_range(Table, Index, FromKey, ToKey) ->
end, Vals)}; end, Vals)};
{error, notfound} -> {error, notfound} ->
{ok, []}; {ok, []};
Error -> {error, _} = Error ->
log_error(Error, get_by_index_range, log_error(Error, get_by_index_range,
[{table, Table}, {index, Index}, [{table, Table}, {index, Index},
{start_key, FromKey}, {end_key, ToKey}]), {start_key, FromKey}, {end_key, ToKey}]),
@ -226,7 +228,7 @@ get_raw(Table, Key) ->
case get_object_raw(Table, Key) of case get_object_raw(Table, Key) of
{ok, Obj} -> {ok, Obj} ->
{ok, riakc_obj:get_value(Obj)}; {ok, riakc_obj:get_value(Obj)};
Error -> {error, _} = Error ->
Error Error
end. end.
@ -240,6 +242,8 @@ get_keys(Table) ->
[{map, {modfun, ?MODULE, map_key}, none, true}]) of [{map, {modfun, ?MODULE, map_key}, none, true}]) of
{ok, [{_, Keys}]} -> {ok, [{_, Keys}]} ->
{ok, Keys}; {ok, Keys};
{ok, []} ->
{ok, []};
{error, _} = Error -> {error, _} = Error ->
log_error(Error, get_keys, [{table, Table}]), log_error(Error, get_keys, [{table, Table}]),
Error Error
@ -257,6 +261,8 @@ get_keys_by_index(Table, Index, Key) ->
[{map, {modfun, ?MODULE, map_key}, none, true}]) of [{map, {modfun, ?MODULE, map_key}, none, true}]) of
{ok, [{_, Keys}]} -> {ok, [{_, Keys}]} ->
{ok, Keys}; {ok, Keys};
{ok, []} ->
{ok, []};
{error, _} = Error -> {error, _} = Error ->
log_error(Error, get_keys_by_index, [{table, Table}, log_error(Error, get_keys_by_index, [{table, Table},
{index, Index}, {index, Index},
@ -277,6 +283,8 @@ get_by_index_raw(Table, Index, Key) ->
none, true}]) of none, true}]) of
{ok, [{_, Objs}]} -> {ok, [{_, Objs}]} ->
{ok, Objs}; {ok, Objs};
{ok, []} ->
{ok, []};
{error, _} = Error -> {error, _} = Error ->
Error Error
end. end.
@ -290,6 +298,8 @@ get_by_index_range_raw(Table, Index, FromKey, ToKey) ->
none, true}]) of none, true}]) of
{ok, [{_, Objs}]} -> {ok, [{_, Objs}]} ->
{ok, Objs}; {ok, Objs};
{ok, []} ->
{ok, []};
{error, _} = Error -> {error, _} = Error ->
Error Error
end. end.
@ -320,7 +330,7 @@ count_by_index(Tab, Index, Key) ->
{ok, Cnt}; {ok, Cnt};
{error, notfound} -> {error, notfound} ->
{ok, 0}; {ok, 0};
Error -> {error, _} = Error ->
log_error(Error, count_by_index, log_error(Error, count_by_index,
[{table, Tab}, [{table, Tab},
{index, Index}, {index, Index},