diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2009-10-27 14:26:22 +0000 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2009-10-27 14:26:22 +0000 |
commit | 512d701ef866220bdf5eda8111e894d736dfb60a (patch) | |
tree | 702d8fe9acf1af6337560d43c338451139cfe24a /src | |
parent | backport previous patch to pubsub odbc (diff) |
minor bugfix, thanks to brian Cully (EJAB-1089)
SVN Revision: 2713
Diffstat (limited to 'src')
-rw-r--r-- | src/mod_pubsub/nodetree_dag.erl | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/mod_pubsub/nodetree_dag.erl b/src/mod_pubsub/nodetree_dag.erl index d7094e3e..7074cabc 100644 --- a/src/mod_pubsub/nodetree_dag.erl +++ b/src/mod_pubsub/nodetree_dag.erl @@ -154,17 +154,21 @@ get_parentnodes_tree(Host, NodeID, _From) -> get_subnodes(Host, NodeID, _From) -> get_subnodes(Host, NodeID). +get_subnodes(Host, <<>>) -> + get_subnodes_helper(Host, <<>>); get_subnodes(Host, NodeID) -> case find_node(Host, NodeID) of false -> {error, ?ERR_ITEM_NOT_FOUND}; - _ -> - Q = qlc:q([Node || #pubsub_node{nodeid = {NHost, _}, - parents = Parents} = Node <- mnesia:table(pubsub_node), - Host == NHost, - lists:member(NodeID, Parents)]), - qlc:e(Q) + _ -> get_subnodes_helper(Host, NodeID) end. +get_subnodes_helper(Host, NodeID) -> + Q = qlc:q([Node || #pubsub_node{nodeid = {NHost, _}, + parents = Parents} = Node <- mnesia:table(pubsub_node), + Host == NHost, + lists:member(NodeID, Parents)]), + qlc:e(Q). + get_subnodes_tree(Host, NodeID, From) -> Pred = fun (NID, #pubsub_node{parents = Parents}) -> lists:member(NID, Parents) @@ -224,6 +228,8 @@ validate_parentage(_Key, _Owners, []) -> true; validate_parentage(Key, Owners, [[] | T]) -> validate_parentage(Key, Owners, T); +validate_parentage(Key, Owners, [<<>> | T]) -> + validate_parentage(Key, Owners, T); validate_parentage(Key, Owners, [ParentID | T]) -> case find_node(Key, ParentID) of false -> {error, ?ERR_ITEM_NOT_FOUND}; |