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: %% -*- erlang-indent-level: 4;indent-tabs-mode: nil; fill-column: 92 -*-
  %% ex: ts=4 sw=4 et
  %%
  %% Copyright 2014 CHEF Software, Inc. All Rights Reserved.
  %%
  %% This file is provided to you under the Apache License,
  %% Version 2.0 (the "License"); you may not use this file
  %% except in compliance with the License.  You may obtain
  %% a copy of the License at
  %%
  %%   http://www.apache.org/licenses/LICENSE-2.0
  %%
  %% Unless required by applicable law or agreed to in writing,
  %% software distributed under the License is distributed on an
  %% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  %% KIND, either express or implied.  See the License for the
  %% specific language governing permissions and limitations
  %% under the License.
  %%
  %% @author Seth Falcon <seth@getchef.com>
  %% @copyright 2014 CHEF Software, Inc. All Rights Reserved.
  %% @doc Record to DB mapping module and behaviour.
  %%
  %% This module helps you map records to and from the DB using prepared
  %% queries. By creating a module, named the same as your record, and
  %% implementing the `sqerl_rec' behaviour, you can take advantage of a
  %% default set of generated prepared queries and helper functions
  %% (defined in this module) that leverage those queries.
  %%
  %% Most of the callbacks can be generated for you if you use the
  %% `exprecs' parse transform. If you use this parse transform, then
  %% you will only need to implement the following three callbacks in
  %% your record module:
  %%
  %% <ul>
  %% <li>``'#insert_fields'/0'' A list of atoms describing the fields (which
  %% should align with column names) used to insert a row into the
  %% db. In many cases this is a proper subset of the record fields to
  %% account for sequence ids and db generated timestamps.</li>
  %% <li>``'#update_fields'/0'' A list of atoms giving the fields used for
  %% updating a row.</li>
  %% <li>``'#statements'/0'' A list of `[default | {atom(),
  %% iolist()}]'. If the atom `'default'' is included, then a default
  %% set of queries will be generated. Custom queries provided as
  %% `{Name, SQL}' tuples will override any default queries of the same
  %% name.</li>
  %% </ul>
  %%
  %% If the table name associated with your record name does not follow
  %% the naive pluralization rule implemented by `sqerl_rel', you can
  %% export a ``'#table_name'/0'' function to provide the table name for
  %% the mapping.
  %%
  %% @end
  -module(sqerl_rec).
  
  -export([
  