anchor.diff:      pack_datetime({Date, {Y, M, erlang:round(S)}});
   pack_datetime(DateTime) ->
       "TIMESTAMP " ++dh_date:format("'Y-m-dTH:i:s'",DateTime).
  -    
  +
   
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   
  
positive.code:                 {error, Reason} ->
                      {error, Reason}
              end;
          false -> 
  	    {error, {module_not_loaded, Type}}
      end.
  
  count(Conn, Type, Conditions) ->
      ConditionClause = build_conditions(Type, Conditions),
      TableName = boss_record_lib:database_table(Type),
      {ok, _, [{Count}]} = pgsql:equery(Conn, 
          ["SELECT COUNT(*) AS count FROM ", TableName, " WHERE ", ConditionClause]),
      Count.
  
  counter(Conn, Id) when is_list(Id) ->
      Res = pgsql:equery(Conn, "SELECT value FROM counters WHERE name = $1", [Id]),
      case Res of
          {ok, _, [{Value}]} -> Value;
          {error, _Reason} -> 0
      end.
  
  incr(Conn, Id, Count) ->
      Res = pgsql:equery(Conn, "UPDATE counters SET value = value + $1 WHERE name = $2 RETURNING value", 
          [Count, Id]),
      case Res of
          {ok, _, _, [{Value}]} -> Value;
          {error, _Reason} -> 
              Res1 = pgsql:equery(Conn, "INSERT INTO counters (name, value) VALUES ($1, $2) RETURNING value", 
                  [Id, Count]),
              case Res1 of
                  {ok, _, _, [{Value}]} -> Value;
  
negative.code:     AttributeColumns	= boss_record_lib:database_columns(Type),
  
      RetypedForeignKeys	= boss_sql_lib:get_retyped_foreign_keys(Type),
  
      apply(Type, new, lists:map(fun
                  (id) ->
                      DBColumn = proplists:get_value('id', AttributeColumns),
  