Permalink
Browse files

Merge pull request #20 from jgordor/master

fix mysql_driver update query with undefined foreign key value
  • Loading branch information...
2 parents 4f3493d + 709028d commit e85067476506d3487de3293ebdf0602e517e30d0 @evanmiller evanmiller committed Jun 18, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/db_adapters/boss_db_adapter_mysql.erl
@@ -255,11 +255,11 @@ build_update_query(Record) ->
({id, _}, Acc) -> Acc;
({A, V}, Acc) ->
AString = atom_to_list(A),
- Value = case lists:suffix("_id", AString) of
- true ->
+ Value = case {lists:suffix("_id", AString), V =:= undefined} of
+ {true, false} ->
{_, _, ForeignId} = infer_type_from_id(V),
ForeignId;
- false ->
+ _ ->
V
end,
[AString ++ " = " ++ pack_value(Value)|Acc]

0 comments on commit e850674

Please sign in to comment.