|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Yaws + Mnesia problemHi,
I am currently struggling with how to access Mnesia database from Yaws script. I got following error: ERROR erlang code crashed: File: c:/Program Files/Yaws-1.84/www/januar/Proyek1/src/suggest.yaws:1 Reason: {function_clause, [{m10,'-out/1-lc$^0/1-0-', [{qlc_handle, {qlc_table,#Fun,true, #Fun,#Fun, #Fun,#Fun, #Fun,#Fun, '=:=',undefined,no_match_spec}}, "bank"]}, {m10,out,1}, {yaws_server,deliver_dyn_part,8}, {yaws_server,aloop,3}, {yaws_server,acceptor0,2}, {proc_lib,init_p_do_apply,3}]} Req: {http_request,'GET', {abs_path,"/januar/Proyek1/src/suggest.yaws?search_words=bank"}, {1,1}} Stack: [{m10,'-out/1-lc$^0/1-0-', [{qlc_handle,{qlc_table,#Fun,true, #Fun, #Fun, #Fun, #Fun, #Fun, #Fun,'=:=',undefined, no_match_spec}}, "bank"]}, {m10,out,1}, {yaws_server,deliver_dyn_part,8}, {yaws_server,aloop,3}, {yaws_server,acceptor0,2}, {proc_lib,init_p_do_apply,3}] My code in suggest.yaws is following: <erl> %%-include("common.hrl"). %%-include("records.hrl"). do(Q) -> F = fun() -> qlc:e(Q) end, {atomic, Val} = mnesia:transaction(F), Val. keyval(K,L) -> {value, {K, V}} = lists:keysearch(K,1,L), V. -record(suggest, {prefix, top_words}). out(A) -> Arg = yaws_api:parse_query(A), %% search_words Prefix = keyval("search_words", Arg), SearchWords = do(qlc:q([X#suggest.top_words || X <- mnesia:table(suggest), X#suggest.prefix =:= Prefix ])), %SearchWords = do(qlc:q([X#suggest.top_words || X <- mnesia:table(suggest) ])), %SearchWords = Prefix, {ehtml, {pre,[], f("~p", [SearchWords])} }. </erl> The offending lines is: SearchWords = do(qlc:q([X#suggest.top_words || X <- mnesia:table(suggest), X#suggest.prefix =:= Prefix ])), I don't understand why yaws complaints about =:= as shown in '=:=',undefined,no_match_spec}}, I would expect to get some helps/hints from Yaws community. Thanks, -- Januar V. Simarmata ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Erlyaws-list mailing list Erlyaws-list@... https://lists.sourceforge.net/lists/listinfo/erlyaws-list |
|
|
Re: Yaws + Mnesia problemHi,
You need to include qlc.hrl to be able to use qlc. It should be something like: -include("/usr/local/lib/erlang/lib/stdlib-1.16.2/include/qlc.hrl"). Andrew On Thu, Aug 20, 2009 at 6:12 PM, Januar V. Simarmata (G!) <januarvs@...> wrote: Hi, ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Erlyaws-list mailing list Erlyaws-list@... https://lists.sourceforge.net/lists/listinfo/erlyaws-list |
|
|
Re: Yaws + Mnesia problemHi Andrew,
Wonderful! It works. Thanks a lot, Januar On Thu, Aug 20, 2009 at 11:34 PM, andrew mmc <andrewmmc@...> wrote: Hi, -- Januar V. Simarmata Follow me on Twitter @januarvs ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Erlyaws-list mailing list Erlyaws-list@... https://lists.sourceforge.net/lists/listinfo/erlyaws-list |
| Free embeddable forum powered by Nabble | Forum Help |