I'm trying to use it as well. I just tracked down the same problem.
Tree is unnecessary so here's what I have for
erlydb_mnesia:get_metadata/1.
get_metadata(_Options) ->
% NOTE Integration with mnesia_rdbms would be interesting...
Tables = mnesia:system_info(tables) -- [schema],
lists:foldl(
fun(Table, TablesTree) ->
gb_trees:enter(Table, get_metadata(Table, table_fields
(Table)), TablesTree)
end, gb_trees:empty(), Tables).
/michael.
On Nov 13, 6:02 am, John Webb <[EMAIL PROTECTED]> wrote:
> Jeff,
>
> If you are using erlydb 0.7.x try editing the mnesia driver source
> file src/erlydb/erlydb_mnesia.erl, look for the function get_metadata/
> 1 and change the return value from {ok,Tree} to Tree. That should
> solve your compile problem (after recompiling erlydb of course).
>
> From 0.6 to 0.7 there was an internal api change and the mnesia
> driver got left behind -- I guess not to many people are using erlyweb
> with the mnesia driver :( There was a patch for this but I'm not sure
> if it made it to the main stream.
>
> Hope this helps,
>
> John
>
> On Nov 13, 2008, at 2:17 PM, jm wrote:
>
>
>
> > The error below is the result of trying to use mnesia as the back end
> > database. Mnesia was chosen for this as it was already used for
> > another
> > erlang application and this is suppose to be the web front end to it.
> > The table is created successfully using similar code to that defined
> > below (the record_info/2 function call is replaced manually with [id,
> > username, password, roles] and Nodes is replaced by [nodes()] to run
> > it
> > from the shell). The module is otherwise empty except for the copiler
> > directives. When it comes to compiling it complains of "no function
> > clause matching" (see further down in this message for the dump). Any
> > thought or suggestions on how to correct this?
>
> > Also, what should the {Field, {Type, Modifier}, Null, Key, Default,
> > Extra, MnesiaType} be for record element roles if it's to be a list of
> > atoms?
>
> > Jeff.
>
> > %% mgr_user.erl
> > -record(mgr_user, {
> > id,
> > username,
> > password,
> > roles = [] %% roles take the form
> > module_action
> > }).
>
> > create_table(Nodes) when is_list(Nodes) ->
> > mnesia:create_table(counter, [{disc_copies, Nodes}, {attributes,
> > [key, counter]}]),
> > mnesia:create_table(mgr_user, [{disc_copies, Nodes},
> > {attributes, record_info(fields,
> > mgr_user)},
> > {user_properties,
> > [
> > %% {Field, {Type, Modifier},
> > Null, Key, Default, Extra, MnesiaType}
> > %% {id,
> > {integer,undefined},false,primary,undefined,undefined,integer},
> > {username,
> > {varchar,undefined},false,undefined,undefined,undefined,list},
> > {password,
> > {varchar,undefined},false,undefined,undefined,undefined,list},
> > {roles,
> > {varchar,undefined},false,undefined,undefined,undefined,list}
> > ]
> > }
> > ]),
> > mnesia:dirty_update_counter(counter, mgr_user, 1).
>
> >> erlyweb:compile("mgr_erlyweb",[{erlydb_driver, mnesia}]).
> > debug:erlyweb_compile:379: Compiling Erlang file "mgr_user_controller"
> > debug:erlyweb_compile:379: Compiling Erlang file "mgr_user"
> > debug:erlyweb_compile:114: Generating ErlyDB code for models:
> > "mgr_user.erl "
> > debug:erlydb:355:
>
> > --- To skip foreign key checks, compile with the {skip_fk_checks,
> > true}
> > option
>
> > ** exception error: no function clause matching
> > gb_trees:lookup_1(mgr_user,
> > {3,
> > {mgr_user,
>
> > [{erlydb_field,username,"username",<<"username">>,
>
> > varchar,undefined,binary,text_field,false,undefined,
>
> > undefined,undefined,undefined},
> > ....
> > in function erlydb:gen_module_code/5
> > in call from lists:foreach/2
> > in call from erlyweb_compile:compile/2
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---