anchor.diff:  bin_to_atom(B) ->
       erlang:binary_to_atom(B, utf8).
   
  +%% @doc Given a list of module (and record) names implementing the
  +%% `sqerl_rec' behaviour, return a proplist of prepared queries in the
  +%% form of `[{QueryName, SQLBinary}]'. If the atom `'default'' is
  +%% present in the list, then a default set of queries will be
  +%% generated. These include: `fetch_by_id', `fetch_by_name',
  +%% `delete_by_id', `insert', `fetch_all', `fetch_page', and
  +%% `update'. The returned query names will have `Recname_'
  +%% prepended. Custom queries override default queries of the same
  +%% name.
   -spec statements([atom()]) -> [{atom(), binary()}].
   statements(RecList) ->
       lists:flatten([ statements_for(RecName) || RecName <- RecList ]).
  
positive.code:             ensure_error(Error)
      end.
  
  -spec update(db_rec()) -> ok | {error, _}.
  update(Rec) ->
      RecName = rec_name(Rec),
  
negative.code:     case sqerl:select(Query, Vals) of
          {ok, none} ->
              [];
          {ok, Rows} ->
              rows_to_recs(Rows, RecName);
          Error ->
              ensure_error(Error)
      end.
  
  %% @doc Return a list of `RecName' records using single parameter
  %% prepared query `RecName_fetch_by_By' where `By' is a field and
  %% column name and `Val' is the value of the column to match for in a
  %% WHERE clause. A (possibly empty) list of record results is returned
  %% even though a common use is to fetch a single row.
  -spec fetch(atom(), atom(), any()) -> [db_rec()] | {error, _}.
  fetch(RecName, By, Val) ->
      Query = join_atoms([RecName, '_', fetch_by, '_', By]),
      qfetch(RecName, Query, [Val]).
  
  %% @doc Return all rows from the table associated with record module
  %% `RecName'. Results will, by default, be ordered by the name field
  %% (which is assumed to exist).
  -spec fetch_all(atom()) -> [db_rec()] | {error, _}.
  fetch_all(RecName) ->
      Query = join_atoms([RecName, '_', fetch_all]),
      qfetch(RecName, Query, []).
  
  %% @doc Fetch rows from the table associated with record module
  %% `RecName' in a paginated fashion. The default generated query, like
  %% that for `fetch_all', assumes a `name' field and column and orders
  %% results by this field. The `StartName' argument determines the
  %% start point and `Limit' the number of items to return. To fetch the
  %% "first" page, use {@link first_page/0}. Use the last name received
  %% as the value for `StartName' to fetch the "next" page.
  -spec fetch_page(atom(), string(), integer()) -> [db_rec()] | {error, _}.
  fetch_page(RecName, StartName, Limit) ->
      Query = join_atoms([RecName, '_', fetch_page]),
      qfetch(RecName, Query, [StartName, Limit]).
  
  %% @doc Return an ascii value, as a string, that sorts less or equal
  %% to any valid name.
  first_page() ->
      "\001".
  
  %% @doc Insert record `Rec' using prepared query `RecName_insert'. The
  %% fields of `Rec' passed as parameters to the query are determined by
  %% `RecName:'#insert_fields/0'. This function assumes the query uses
  %% "INSERT ... RETURNING" and returns a record with db assigned fields
  %% (such as sequence ids and timestamps filled out).
  -spec insert(db_rec()) -> [db_rec()] | {error, _}.
  insert(Rec) ->
      RecName = rec_name(Rec),
  