anchor.diff:          id ->
               Record1 = maybe_populate_id_value(Record),
               Type = element(1, Record1),
  -            Query = build_insert_query(Record1),
  -            Res = pgsql:equery(Conn, Query, []),
  +            {Query,Params} = build_insert_query(Record1),
  +            Res = pgsql:equery(Conn, Query, Params),
               case Res of
                   {ok, _, _, [{Id}]} ->
                       {ok, Record1:set(id, lists:concat([Type, "-", id_value_to_string(Id)]))};
                   {error, Reason} -> {error, Reason}
               end;
           Defined when is_list(Defined) ->
  -            Query = build_update_query(Record),
  -            Res = pgsql:equery(Conn, Query, []),
  +            {Query,Params} = build_update_query(Record),
  +            Res = pgsql:equery(Conn, Query, Params),
               case Res of
                   {ok, _} -> {ok, Record};
                   {error, Reason} -> {error, Reason}
               end
       end.
  -
   
   push(Conn, Depth) ->
       case Depth of 0 -> pgsql:squery(Conn, "BEGIN"); _ -> ok end,
  
positive.code:         uuid -> Record:set(id, uuid:to_string(uuid:uuid4()));
          _ -> Record
  end.
  
  integer_to_id(Val, KeyString) ->
      ModelName = string:substr(KeyString, 1, string:len(KeyString) - string:len("_id")),
      ModelName ++ "-" ++ id_value_to_string(Val).
  
  activate_record(Record, Metadata, Type) ->
      AttributeTypes = boss_record_lib:attribute_types(Type),
  
negative.code:                     false ->
                          V
                  end,
                  {[DBColumn|Attrs], [Value|Vals]}
          end, {[], []}, Record:attributes()),
      TempList=lists:seq(1,length(Attributes)),
      Params= lists:map(fun(E)->"$"++integer_to_list(E) end,TempList),
      {["INSERT INTO ", TableName, " (", 
          string:join(Attributes, ", "),
          ") values (",
          string:join(Params, ", "),
          ")",
          " RETURNING id"
      ],Values}.
  
  build_update_query(Record) ->
      {Type, TableName, IdColumn, Id} = boss_sql_lib:infer_type_from_id(Record:id()),
      AttributeColumns = Record:database_columns(),
      {Attributes, Values} = lists:foldl(fun
              ({id, _}, Acc) -> Acc;
              ({A, V}, {Attrs, Vals}) -> 
                  DBColumn = proplists:get_value(A, AttributeColumns),
                  Value = case {boss_sql_lib:is_foreign_key(Type, A), V =/= undefined} of
                      {true, true} ->
  