mnesia and nul data

Wes James comptekki@REDACTED
Fri May 7 22:09:07 CEST 2010


I am trying to learn how to use mnesia.  I have some test data from a
csv file that I wrapped in {table_name, field1, field2, .... }

and I'm using the company.erl example as an example to insert this
data in to the test table.  I've been looking around, but I don't see
how to put nul data in to mnesia as compiler doesn't seem to like
"field,,field2" where ,, is the nul field value.  What is the
recommend way to put blank data in to mnesia?  "" or _  or []?

I have for the record:

-record(
	qlibc,
	{
		id,
		title,
		author_editor,
		date_of_publication,
		publisher,
		collection_type,
		key_words,
		notes,
		call_number,
		publication_source,
		holdings,
		physical_placement
	}
).


The insert function:

fill_tables() ->
    Qlibc =
        [{qlibc,0,"Reference document: needs assessment for the food
and agricultural sciences",[],1984,"Joint Council on food and
Agricultural Sciences","Documents",[],[],"DOCUMENT A485",[]}
        ],

    [mnesia:dirty_write(W) || W <- Qlibc],

    ok.

but I get:

25> qlibc:fill_tables().
** exception exit: {aborted,{bad_type,{qlibc,0,
                                             "Reference document:
needs assessment for the food and agricultural sciences",
                                             [],1984,
                                             "Joint Council on food
and Agricultural Sciences",

"Documents",[],[],"DOCUMENT A485",[]}}}
     in function  mnesia:abort/1
     in call from qlibc:'-fill_tables/0-lc$^0/1-0-'/1
     in call from qlibc:fill_tables/0


What's going on?

thx,

-wes


More information about the erlang-questions mailing list