anchor.diff:          _:{'ClientError', {Text, Reason}} ->    ?ClientError({Text, {Item,Reason}});
           _:_ ->                                  ?ClientError({"Data conversion format error",{Item,{pretty_type(Type),Val}}})
       end;
  -value_cast(_Item,_Old,_Type,_Len,_Prec,_Def,_RO,Val) -> Val.    
  +value_to_db(_Item,_Old,_Type,_Len,_Prec,_Def,_RO,Val) -> Val.    
   
   
   string_to_list(Val,Len) ->
  
positive.code: 
  -include("imem_meta.hrl").
  
  -export([ value_cast/8
          ]).
  
  -export([ pretty_type/1
  
negative.code: 
  %% ----- CAST Data from DB to string ------------------
  
  db_to_string(Type, Len, Prec, Val) ->
      if 
          (Type == bigint) ->     integer_to_list(Val);
  %       (Type == blob) ->       string_to_ebinary(Val,Len);
          (Type == character) ->  Val;
          (Type == decimal) ->    decimal_to_string(Val,Prec);
          (Type == date) ->       date_to_string(Val);
          (Type == double) ->     string_to_double(Val,Prec);
          (Type == eatom) ->      list_to_atom(Val);
          (Type == ebinary) ->    string_to_ebinary(Val,Len);
          (Type == ebinstr) ->    list_to_binary(Val);
          (Type == edatetime) ->  string_to_edatetime(Val);
          (Type == efun) ->       string_to_fun(Val,Len);
          (Type == eipaddr) ->    string_to_eipaddr(Val,Len);
          (Type == elist) ->      string_to_elist(Val,Len);
          (Type == enum) ->       string_to_enum(Val,Len);
          (Type == epid) ->       list_to_pid(Val);
          (Type == estring) ->    string_to_list(Val,Len);
          (Type == etimestamp) -> string_to_etimestamp(Val); 
          (Type == etuple) ->     string_to_etuple(Val,Len);
          (Type == float) ->      string_to_float(Val,Prec);
          (Type == int) ->        string_to_integer(Val,Len,Prec);
          (Type == integer) ->    string_to_integer(Val,Len,Prec);
          (Type == longblob) ->   string_to_ebinary(Val,Len);
          (Type == longtext) ->   string_to_list(Val,map(Len,0,4294967295));
          (Type == mediumint) ->  string_to_integer(Val,Len,Prec);
          (Type == mediumtext) -> string_to_list(Val,map(Len,0,16777215));
          (Type == number) ->     string_to_number(Val,Len,Prec);
          (Type == numeric) ->    string_to_number(Val,Len,Prec);
          (Type == set) ->        string_to_set(Val,Len);
          (Type == smallint) ->   string_to_integer(Val,Len,Prec);
          (Type == text) ->       string_to_list(Val,map(Len,0,65535));
          (Type == time) ->       string_to_time(Val);
          (Type == timestamp) ->  string_to_timestamp(Val,Prec);
          (Type == tinyint) ->    string_to_integer(Val,Len,Prec);
          (Type == tinytext) ->   string_to_list(Val,map(Len,0,255));
          (Type == varchar) ->    string_to_list(Val,map(Len,0,255));
          (Type == varchar2) ->   string_to_list(Val,map(Len,0,4000));
          (Type == year) ->       string_to_year(Val);                    
          true ->                 string_to_eterm(Val)   
      end.
  
  date_to_string(Datetime) ->
      date_to_string(Datetime, eu).
  
  