projects
/
euphorik.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
654e586
)
FIX remplacement des match_object par des index_read
author
Greg Burri
<greg.burri@gmail.com>
Sun, 27 Jul 2008 12:12:28 +0000
(12:12 +0000)
committer
Greg Burri
<greg.burri@gmail.com>
Sun, 27 Jul 2008 12:12:28 +0000
(12:12 +0000)
modules/erl/euphorik_bd.erl
patch
|
blob
|
history
diff --git
a/modules/erl/euphorik_bd.erl
b/modules/erl/euphorik_bd.erl
index
dff71db
..
0bda09f
100755
(executable)
--- a/
modules/erl/euphorik_bd.erl
+++ b/
modules/erl/euphorik_bd.erl
@@
-475,15
+475,25
@@
parents_id(M_id) ->
% Renvoie les id des enfants d'un message M (les messages qui répondent à M)
\r
% ordrés du plus petit au plus grand.
\r
% @spec enfants_id(integer()) -> [integer()]
\r
% Renvoie les id des enfants d'un message M (les messages qui répondent à M)
\r
% ordrés du plus petit au plus grand.
\r
% @spec enfants_id(integer()) -> [integer()]
\r
-enfants_id(M) ->
\r
+enfants_id(M_id) ->
\r
+% resultat_transaction(mnesia:transaction(fun() ->
\r
+% e(
\r
+% qlc:sort(
\r
+% q([E#reponse_minichat.repondant || E <- mnesia:table(reponse_minichat), E#reponse_minichat.cible =:= M]),
\r
+% [{order, ascending}]
\r
+% ),
\r
+% [{tmpdir, ?KEY_SORT_TEMP_DIR}]
\r
+% )
\r
+% end)).
\r
resultat_transaction(mnesia:transaction(fun() ->
\r
resultat_transaction(mnesia:transaction(fun() ->
\r
- e(
\r
- qlc:sort(
\r
- q([E#reponse_minichat.repondant || E <- mnesia:table(reponse_minichat), E#reponse_minichat.cible =:= M]),
\r
- [{order, ascending}]
\r
- ),
\r
- [{tmpdir, ?KEY_SORT_TEMP_DIR}]
\r
- )
\r
+ case mnesia:index_read(reponse_minichat, M_id, #reponse_minichat.cible) of
\r
+ Enfants when is_list(Enfants) ->
\r
+ lists:sort(lists:map(
\r
+ fun(#reponse_minichat{repondant = Repondant}) -> Repondant end,
\r
+ Enfants
\r
+ ));
\r
+ _ -> []
\r
+ end
\r
end)).
\r
\r
\r
end)).
\r
\r
\r
@@
-514,7
+524,7
@@
est_une_reponse_a_user(Id_user, Id_mess) ->
a_repondu_a_message(Id_user, Id_mess) ->
\r
resultat_transaction(mnesia:transaction(
\r
fun() ->
\r
a_repondu_a_message(Id_user, Id_mess) ->
\r
resultat_transaction(mnesia:transaction(
\r
fun() ->
\r
- case mnesia:
match_object({reponse_minichat, '_', Id_mess}
) of
\r
+ case mnesia:
index_read(reponse_minichat, Id_mess, #reponse_minichat.cible
) of
\r
[] -> false;
\r
Reponses ->
\r
lists:any(
\r
[] -> false;
\r
Reponses ->
\r
lists:any(
\r