Skip to content

Instantly share code, notes, and snippets.

@hiyosi
Created September 26, 2011 15:47
Show Gist options
  • Save hiyosi/1242551 to your computer and use it in GitHub Desktop.
Save hiyosi/1242551 to your computer and use it in GitHub Desktop.
Mnesiaレコード更新
add(add_http_list, Id, System, Uri, Port) ->
gen_server:call(?MODULE, {add_http_list, Id, System, Uri, Port});
handle_call({add_http_list, Id, System, Uri, Port}, _From, State) ->
{reply, add_record_http_list(Id, System, Uri, Port), State};
%% http_listテーブルにレコードを追加/更新する
add_record_http_list(Id, System, Uri, Port) ->
Row = #http_list{id=Id, system=System, uri=Uri, port=Port},
F = fun() ->
mnesia:write(Row)
end,
mnesia:transaction(F).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment