hi,

i guess,

boss_db:find(...) return a list of record, then WeixinLog:id() doesn't
apply here,

try boss_db:find_first(...) or use this:

[WeixinLog|_] = boss_db:find(weixin, [{macid, 'equals', MacID}]),

mihawk






2014-10-10 15:34 GMT+08:00 Sid Wu <[email protected]>:

> Hi g <https://github.com/davidw>uys ,
>
> These are my code and table:
> deal(MacID, FromUserName, Site) ->
> WeixinLog = boss_db:find(weixin, [{macid, 'equals', MacID}]),
> {output, WeixinLog:id()};
>
> Model:
> -module(weixin, [Id, Macid, Site, Created, Fromusername, Ticket]).
> -compile(export_all).
> -table("weixinTest").
>
> Table:
> CREATE TABLE weixinTest (
> id int(11) NOT NULL AUTO_INCREMENT,
> macid varchar(20) NOT NULL,
> site varchar(100) NOT NULL,
> created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
> fromusername varchar(255) NOT NULL,
> ticket varchar(255) NOT NULL,
> PRIMARY KEY (id)
> )
>
> I got this when visit the url:
> 10:28:31.682 [info] Query SELECT * FROM weixinTest WHERE macid = 'fawfwaf'
> AND TRUE ORDER BY id ASC
> 10:28:31.687 [error] Error in controller error badarg
> [{erlang,apply,[[{weixin,"weixin-1",<<"fawfwaf">>,<<"weixin">>,{{2014,10,9},{14,16,44}},<<"wbfwbf">>,<<"fwafwaf">>}],id,[]],[]},{weixin_t1_s_controller,deal,4,[{file,"/home/sid/weixin_t1/src/controller/weixin_t1_s_controller.erl"},{line,12}]},{boss_web_controller,call_controller_action,3,[{file,"src/boss/boss_web_controller.erl"},{line,316}]},{boss_web_controller,apply_action,4,[{file,"src/boss/boss_web_controller.erl"},{line,308}]},{boss_web_controller,execute_action_inner,9,[{file,"src/boss/boss_web_controller.erl"},{line,287}]},{boss_web_controller_handle_request,process_dynamic_request,5,[{file,"src/boss/boss_web_controller_handle_request.erl"},{line,254}]},{boss_web_controller_handle_request,process_request,5,[{file,"src/boss/boss_web_controller_handle_request.erl"},{line,240}]},{boss_web_controller_handle_request,set_timer,8,[{file,"src/boss/boss_web_controller_handle_request.erl"},{line,160}]}]
>
> What's the problem?
>
> --
> You received this message because you are subscribed to the Google Groups
> "ChicagoBoss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at http://groups.google.com/group/chicagoboss.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/chicagoboss/0170a5ed-0ee4-4da0-a4e7-d18b44dfcd53%40googlegroups.com
> <https://groups.google.com/d/msgid/chicagoboss/0170a5ed-0ee4-4da0-a4e7-d18b44dfcd53%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/chicagoboss/CAB-OfhmWxKnHk6WBGdN1kFYEtwiQ4urH5j9Gtd11dGZhch_MbA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to