Permalink
Browse files

fix mysql_driver update query with undefined foreign key value

  • Loading branch information...
1 parent 4f3493d commit 709028df03a45ce89872b675e5ab382959f7645d @jgordor jgordor 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 709028d

Please sign in to comment.