Skip to content

Instantly share code, notes, and snippets.

@wrboyce
Created August 23, 2011 02:18
Show Gist options
  • Select an option

  • Save wrboyce/1164165 to your computer and use it in GitHub Desktop.

Select an option

Save wrboyce/1164165 to your computer and use it in GitHub Desktop.
handle_call(getBots, _From, State) ->
io:format("handle_call(getBots)~n", []),
T = mnesia:table_info(bot_config,all),
io:format("table_info: ~p~n", [T]),
Q = qlc:q([
C || C <- mnesia:table(bot_config),
C#bot_config.enabled =:= true]),
R = mnesia:transaction(fun() -> qlc:e(Q) end, 3),
io:format("Result: ~p~n", [R]),
{ok, Bots} = R,
Bots = lists:map(fun(C) -> bot_from_config(C) end, BotConfigs),
{reply, {ok, Bots}, State};
handle_call(getBots)
table_info: [{access_mode,read_write},
{active_replicas,[]},
{all_nodes,['[email protected]']},
{arity,6},
{attributes,[id,network,nick,chans,enabled]},
{checkpoints,[]},
{commit_work,[]},
{cookie,{{1314,65769,422545},'[email protected]'}},
{cstruct,{cstruct,bot_config,set,[],
['[email protected]'],
[],0,read_write,false,[],[],false,bot_config,
[id,network,nick,chans,enabled],
[],[],
{{1314,65769,422545},'[email protected]'},
{{2,0},[]}}},
{disc_copies,['[email protected]']},
{disc_only_copies,[]},
{frag_properties,[]},
{index,[]},
{load_by_force,false},
{load_node,unknown},
{load_order,0},
{load_reason,unknown},
{local_content,false},
{majority,false},
{master_nodes,[]},
{memory,306},
{ram_copies,[]},
{record_name,bot_config},
{record_validation,{bot_config,6,set}},
{type,set},
{size,0},
{snmp,[]},
{storage_type,disc_copies},
{subscribers,[]},
{user_properties,[]},
{version,{{2,0},[]}},
{where_to_commit,[]},
{where_to_read,nowhere},
{where_to_write,[]},
{wild_pattern,{bot_config,'_','_','_','_','_'}}]
Result: {aborted,{no_exists,bot_config}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment