chef / sqerl

General purpose RDBMS abstraction layer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cant start application

insiderq opened this issue · comments

Here is the problem, i followed you getting started readme and getting this in console

=ERROR REPORT==== 6-Oct-2014::01:15:07 ===
{incorrect_application_config,sqerl,
{prepared_statements,
{badmatch,undefined},
[{sqerl_rec,expand_if_app,1,[{file,"src/sqerl_rec.erl"},{line,326}]},
{sqerl_rec,'-statements/1-lc$^0/1-0-',1,
[{file,"src/sqerl_rec.erl"},{line,322}]},
{sqerl_rec,statements,1,[{file,"src/sqerl_rec.erl"},{line,322}]},
{sqerl_client,read_statements_from_config,0,
[{file,"src/sqerl_client.erl"},{line,254}]},
{sqerl_client,init,1,[{file,"src/sqerl_client.erl"},{line,126}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,306}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}}

my config is

{sqerl, [
%% Database connection parameters
{db_host, "localhost" },
{db_port, 5432 },
{db_user, "user" },
{db_pass, "easypass" },
{db_name, "mydb" },
{idle_check, 10000},
{column_transforms, []},
{prepared_statements,
{sqerl_rec, statements, [[{app, my_app}]]}}
]},

{pooler, [
{pools, [[{name, sqerl},
{max_count, 10 },
{init_count, 5 },
{start_mfa, {sqerl_client, start_link, []}}]]}
]}

What is the context in which you are running? Is it possible that the system isn't finding the my_app application? Can you try putting the record names there directly in config (as atoms, rather than the {app, AppName} form) and see what happens?

Alternatively, if you build a full release does it happen there in the same way?

Could you please help me with adding record names directly in config, i didnt understand how to do it after reading readme.
my_app is definetly found by the system, it's modules are working perfectly in a shell after starting. Should my_app to be started before the sqerl?

Any chance you can make your example app where you are seeing the issue available?

@seth I get the same errors that @insiderq is getting. Plus, I followed the instructions to the the book and scoured all the documentation. No luck!

It seems to me that the project README assumes too much and is missing some steps. One such case is the absence of the db_driver_mod setting which is required for sqerl to work.

Edit: Sample application here.

UPDATE: @seth Passing the record names as atoms works. Maybe the README and docs need to be updated if this is going to be the scheme of things in the future.