mnemosyne:string_to_handle pb !

Ulf Wiger etxuwig@REDACTED
Wed Dec 13 12:18:58 CET 2000


I cannot help you with the exact problem, except to say that 
the following construct is _much_ more efficient:

mnesia_transaction(
   fun() ->
      P = mnesia:table_info(jabber_personne, wild_pattern),
      mnesia:match_object(P#jabber_personne{age = 22})
   end).

Basically, mnemosyne should be avoided for all queries, unless
you really need the cursor support, or you have very complex queries.

/Uffe

On Wed, 13 Dec 2000, Lecomte Jean François wrote:

>Hi, 
>
>I do need to build a handle query using a string but when i tried to
>use the mnemosyne string_to_handle it fails !
>
>Following code
>
>    Q =  mnemosyne:string_to_handle( "query [ X || X <- table ( jabber_personne ), X.age=22 ] end. "),
>    mnesia:transaction(fun() -> mnemosyne:eval(Q) end).
>
>gives 
>
>{aborted,{function_clause,[{mnemosyne,setup_query,
>                                      [{'EXIT',
>                                           {function_clause,
>                                               [{erl_parse,
>                                                    normalise,
>                                                    [{call,
>                                                         0,
>                                                         {atom,
>                                                             0|...},
>                                                         [{tuple|...}]}]},
>                                                {erl_parse,normalise_list,1},
>                                                {erl_parse,normalise,1},
>                                                {erl_parse,normalise_list,1},
>                                                {erl_parse,normalise,1},
>                                                {mnemosyne_lc,
>                                                    '-one_lc_to_handle/1-fun-1-',
>                                                    2},
>                                                {lists,foldl,3},
>                                                {mnemosyne_lc,
>                                                    one_lc_to_handle,
>                                                    1}|
>                                                more]}}]},
>                           {mnemosyne,cursor,2},
>                           {mnemosyne,eval,1},
>                           {mnesia_tm,apply_fun,2},
>                           {mnesia_tm,execute_transaction,4},
>                           {erl_eval,expr,3},
>                           {erl_eval,exprs,4},
>                           {shell,eval_loop,2}]}}
>
>
>
>but :
>    query [ X || X <- table ( jabber_personne ), X.age=22 ] end,
>    mnesia:transaction(fun() -> mnemosyne:eval(Q) end).
>
>works fine !
>
>Any idea
>
>

-- 
Ulf Wiger                                    tfn: +46  8 719 81 95
Senior System Architect                      mob: +46 70 519 81 95
Strategic Product & System Management    ATM Multiservice Networks
Data Backbone & Optical Services Division      Ericsson Telecom AB




More information about the erlang-questions mailing list