Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Commit

Permalink
flatzone call was returning a list.
Browse files Browse the repository at this point in the history
Update return value convention in ezic_db_ets:flatzone() to match ezic_db:flatzone().
  • Loading branch information
lsowen committed Nov 3, 2012
1 parent e8385d7 commit fe6db38
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/ezic_db_ets.erl
Expand Up @@ -90,8 +90,18 @@ handle_call({all, Table}, _, Ets) ->
Matches= ets:lookup(Ets, Table),
{reply, Matches, Ets};
handle_call({flatzone, Date, Name}, _, Ets) ->
Matches= ets:select(Ets, ezic_flatten:ms(Date, Name)),
{reply, Matches, Ets};
FlatZones= ets:select(Ets, ezic_flatten:ms(Date, Name)),
Result= case length(FlatZones) of
1 ->
hd(FlatZones);
2 ->
erlang:error(ambiguous_zone, FlatZones);
0 ->
erlang:error(no_zone);
_ ->
erlang:error(should_not_happen, {FlatZones, Date, Name})
end,
{reply, Result, Ets};
%handle_call({insert_all, Records}, _, Ets) ->
% Result= ets:insert(Ets, Records),
% {reply, Result, Ets};
Expand Down

0 comments on commit fe6db38

Please sign in to comment.