Problems integrating BeepBeep and ErlyDB

In addition to my adventures with Erlang and ErlyDB. I am trying to get ErlyDB to work with BeepBeep

My ErlyDB setup works correctly when it runs outside of the BeepBeep environment (see Debugging ErlyDB and MySQL ). I basically take working code and try to run it in BeepBeep.

My controller has the following code:

handle_request("index",[]) ->
  erlydb:start(mysql,Database),
  erlydb:code_gen(["thing.erl"],mysql), 
  NewThing = thing:new_with([{name, "name"},{value, "value"}]),
  thing:save(NewThing),
  {render,"home/index.html",[{data,"Hello World!"}]};

When I call the URL, the response displays "Server Error". There is no other information about errors or exceptions.

I tried wrapping the call in try / catch to see if there is a main error - there is definitely an exception when calling : new_with () , but there is no additional information,

Stacktrace reports:

{thing,new,[["name","value"]]}
{home_controller,create,1}
{home_controller,handle_request,3}
{beepbeep,process_request,4}
{test_web,loop,1}
{mochiweb_http,headers,4}
{proc_lib,init_p_do_apply,3}
+3
1

, , : new/1:

ok = erlydb:start(mysql,Database),
ok = erlydb:code_gen(["thing.erl"],mysql), 

, . , , "undef". , . , : new/1 [ "name", "value" ] .

, handle_request, home_controller: /1 {home_controller,create,1} . handle_request/2?

+2

Source: https://habr.com/ru/post/1714386/


All Articles