anchor.diff:  -type insert_id()   :: term().
   -type update_id()   :: term().
   -type proplist()    :: {atom() | value()}.
  +-type json()        :: list().
   -type return_type() :: dict | list | proplist | tuple.
   
   -spec get_env(Var :: atom(), Def :: term()) -> term().
  
positive.code: format_key(K) when is_list(K) ->
      list_to_atom(K).
  
  format_list_result(Json) ->
      [
          [format_value(Value) || {_,Value} <- Row]
      || Row <- Json].
  
  format_tuple_result(Json) ->
      [list_to_tuple(Row) || Row <- format_list_result(Json)].
  
  format_proplist_result(Json) ->
      [
          [{format_key(F), format_value(V)} || {F,V} <- Row]
      || Row <-Json].
  
  format_dict_result(Json) ->
      [dict:from_list(PL) || PL <- format_proplist_result(Json)].
  
  
  %%  A special Query function just for inserting.
  %%  Inserts the record(s) and returns the insert_id
  qi(Q) ->
      Db = db(),
      db_q(insert,Db,Q).
  
  qi(Q,ParamList) ->
      Db = db(),
      db_q(insert,Db,Q,ParamList).
  
  qu(Q) ->
      Db = db(),
      db_q(update, Db, Q).
  
  qu(Q, ParamList) ->
      Db = db(),
      db_q(update, Db, Q, ParamList).
  
  
  %% fr = First Record
  plfr(Q,ParamList) ->
      case plq(Q,ParamList) of
          [] -> not_found;
  
negative.code:         [First|_] -> First
      end.
  
  -spec plfr(Q :: sql()) -> proplist() | not_found.
  plfr(Q) ->
      plfr(Q,[]).
  
  