patch to mnesia

luc.taesch <>
Mon Sep 4 15:14:04 CEST 2000


im happy to ( humbly ?) contribute my first patch.(well, maybe).

on mnesia 3.8.2, linux, i cant have mnesia:load_textfile working.

i found that in mnesia_text.erl, L78, make_tabs/1 uses:
 case catch mnesia:table_info(Tab, size) of
	{'EXIT', _} -> %% non-existing table
to check the prior existence to the table Tab.

unfortunately, mnesia:table_info( non_existent_table, size) returns 0 on my 
release., and not {EXIT..} (which is fair)

ill suggest using table_info(Tab, record_info) instead, which does reply exit 
for a  non_existent_table.

another one
:  line 80 Attrs is a list, so  
 case mnesia:create_table(Tab, [{attributes, [Attrs]}])
should be:
  case mnesia:create_table(Tab, [{attributes, Attrs}])


here is the final working code code :

diff /home/luc/test/otp_src_R6B-0/lib/mnesia/src/mnesia_text.erl 
/usr/local/lib/erlang/lib/mnesia-3.8.2/src/mnesia_text.erl
78c78
<     case catch mnesia:table_info(Tab, size) of
---
>     case catch mnesia:table_info(Tab, record_info) of
80c80
<           case mnesia:create_table(Tab, [{attributes, [Attrs]}]) of
---
>           case mnesia:create_table(Tab, [{attributes, Attrs}]) of
[ src]$    




More information about the erlang-questions mailing list