Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Mnesia has event based notifications. Its possible to have a process (gen_server) which subscribes to mnesia events. These events are categorised: Table events, System events and others. Read the mnesia documentation at the part concerning events. Its actually possible for a process to report events using mnesia event handler by calling: <code>mnesia:report_event(Event)</code>. All process subscribed to mnesia events will get this message. Mnesia will report real-time information about all transactions on a table to subscribed processes. There can be read, write or delete transactions and a process in its loop can pattern match the type of event it may be interested in. There are detailed and simple table events. I have personally found the events very useful. You should be able to get the details from the documentation.</p> <p>About events. Now mnesia tables store records of the same type. This info can be accessed by calling <code>mnesia:table_info(Table_name::atom(),attributes)</code>. When applying indexes on a mnesia table, it will accept any field from those attributes as long as it is not the first record field( normally called "primary key").These indexes are better if applied at table creation than at runtime due to a number of reasons. Consider the code snippet below<br></p> <pre> -record(employee,{id,first_name,other_name,sex,age,job}). install(Nodes)-> mnesia:create_schema(Nodes), mnesia:start(), mnesia:create_table(employee,[{index,[age,sex,first_name,job]},<br> {attributes,record_info(fields,employee)}]), mnesia:stop(), ok. </pre> <p>if i have understood your question well, i can now say that the table employee has columns: age,sex,first_name,other_name, and job indexed and all mnesia APIs for record searching based on indexed attributes wiil work e.g. <code>mnesia:index_read/3 or mnesia:index_match_object/2 or mnesia:index_match_object/4</code>. good luck</p> <p>/joshmuza@gmail.com</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload