Erlang/OTP Forums

Author Message

<  Erlang questions mailing list  ~  Mnesia question

mikl at club-internet.fr
Posted: Sun Apr 25, 1999 12:48 pm Reply with quote
Guest
Hi,

I have got a question about an error in my mnesia queries.



When I try to make a joint query on two tables I get this error message
:

=ERROR REPORT==== 25-Apr-1999::14:38:23 ===
!!! Error in process <0.188.0> on node 'master_at_win' with exit value:
nocatch
** exited: nocatch **


The code I am using for this query is :
task(User) ->
Q = query
[ T ||
T <- table(tasks),
U <- table(users),
U.id = User,
T.user_id = U.id ]
end,
F = fun() -> mnemosyne:eval(Q) end,
mnesia:transaction(F).



The data is the database seems correct. When I make a simple query, the
function is working, but I did not manage to make this two tables query
to work.
Do you have any clue on what I am doing wrong ?

Thank you in advance.

Mickael Remond



Post generated using Mail2Forum (http://m2f.sourceforge.net)
tobbe at serc.rmit.edu.au
Posted: Sun Apr 25, 1999 10:28 pm Reply with quote
Guest
Shouldn't you use the Boolean test operator for equality ?
That is:

task(User) ->
Q = query
[ T ||
T <- table(tasks),
U <- table(users),
U.id == User,
T.user_id == U.id ]
end,
F = fun() -> mnemosyne:eval(Q) end,
mnesia:transaction(F).


/Tobbe


Post generated using Mail2Forum (http://m2f.sourceforge.net)
mikl at club-internet.fr
Posted: Mon Apr 26, 1999 6:12 am Reply with quote
Guest
Torbjorn Tornkvist a
hakan at erix.ericsson.se
Posted: Mon Apr 26, 1999 7:04 am Reply with quote
Guest
mikl>I suspect a misconfiguration, but I did not see what I a missing.

I think that you forgot to start the mnemosyne application.

The attached example worked for me, when Mnemosyne was started.

~> erl
Erlang (BEAM) emulator version 4.8.1
=20
Eshell V4.8.1 (abort with ^G)
1> c(memo().
** 1: syntax error before: '.' **
1> c(memo).=20
./memo.erl:27: Warning: non-recommended option 'export_all' used
{ok,memo}
2> memo:init().
ok
3> memo:task(hakan). =20
{atomic,[{tasks,drink_coffee,hakan}]}
4> application:stop(mnemosyne).
=20
=3DINFO REPORT=3D=3D=3D=3D 26-Apr-1999::08:54:17 =3D=3D=3D
=09application: mnemosyne
=09exited: stopped
=09type: temporary
ok
5> memo:task(hakan). =20
=20
=3DERROR REPORT=3D=3D=3D=3D 26-Apr-1999::08:54:19 =3D=3D=3D
<0.25.0> error: nocatch in mnemosyne_lc:the_query/1
** exited: nocatch **
=20
Regards

=09H=E5kan
-------------------------------------+------------------------------------
H=E5kan Mattsson, | +46 8 719 9452
Computer Science Laboratory | hakan_at_erix.ericsson.se
Ericsson Network Core Products | http://www.ericsson.se/cslab/~hakan
Box 1505, SE-126 25 Stockholm Sweden |


Post generated using Mail2Forum (http://m2f.sourceforge.net)

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum