#238 breaks m_config:set_value/4 #244

Closed
kaos opened this Issue Oct 27, 2011 · 3 comments

Projects

None yet

3 participants

Owner
kaos commented Oct 27, 2011
=SUPERVISOR REPORT==== 27-Oct-2011::16:41:05 ===
     Supervisor: {<0.184.0>,z_site_sup}
     Context:    start_error
     Reason:     {'EXIT',{{case_clause,[]},
                          [{m_config,set_value,4},
                           {z_site_startup,start_link,1},
                           {supervisor,do_start_child,2},
                           {supervisor,start_children,3},
                           {supervisor,init_children,2},
                           {gen_server,init_it,6},
                           {proc_lib,init_p_do_apply,3}]}}
     Offender:   [{pid,undefined},
                  {name,z_site_startup},
                  {mfargs,
                      {z_site_startup,start_link,
                          [[{enabled,true},
                            {host,maberlz},
                            {hostname,"xxxx"},
                            {dbdatabase,"zotonic"},
                            {dbschema,"public"},
                            {admin_password,"xxxx"}]]}},
                  {restart_type,permanent},
                  {shutdown,5000},
                  {child_type,worker}]

The case only expects a 0 or 1:

case z_db:q("update config set value = $1, modified = now() where module = $2 and key = $3", [Value, Module, Key], Context) of
    0 -> z_db:insert(config, [{module,Module}, {key, Key}, {value, Value}], Context);
    1 -> ok
end,

but 0 is now always translated to []... so this could creep up in a lot of places, right?

I suggest improving the solution of issue #238.

Owner
arjan commented Oct 27, 2011

I agree. I really like that the update statement returns the nr. of rows affected...

Owner

I too.

Rollback of the last change and think of something new?

Any takers?

Owner
arjan commented Oct 28, 2011

Rolled back. See #247

@arjan arjan closed this Oct 28, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment