anchor.diff:  form_condition({Key, {ge, _Value}}) ->
     lists:flatten(["(", escape(Key), ">=?", ")"]);
   
  -form_condition({Key, undefined}) ->
  +form_condition({_Key, undefined}) ->
     "";
   
   form_condition({Key, _Value}) ->
  
positive.code: %%% Exports.
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %%% Public API.
  -export([i/3, u/4, d/3]).
  -export([s/8, s_count/5]).
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %%% Public API.
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% @doc Returns number of results, useful for pagination.
  -spec s_count(
    atom(), string(), [string()|atom()], proplists:proplist(), string()
  ) -> iolist().
  s_count(QueryName, TableName, SelectFields, Conditions, ExtraWhere) ->
    {_Select, Where, WValues} = form_select_query(SelectFields, Conditions, ExtraWhere),
    ["SELECT COUNT(1) AS `count` FROM ", escape(TableName), " WHERE ", Where].
  
  %% @doc Generic select function.
  -spec s(
    atom(), string(), [string()|atom()],
    proplists:proplist(), string(), pos_integer(), pos_integer(), string()
  ) -> iolist().
  s(QueryName, TableName, SelectFields, Conditions, ExtraWhere, Page, PageSize, OrderBy) ->
    Paging = [" LIMIT ", integer_to_list((Page-1) * PageSize), ",", integer_to_list(PageSize)],
    {Select, Where, WValues} = form_select_query(SelectFields, Conditions, ExtraWhere),
    ["SELECT ", Select, " FROM ", escape(TableName), " WHERE ", Where, " ", OrderBy, " ", Paging].
  
  %% @doc INSERT.
  -spec i(atom(), string(), proplists:proplist()) -> iolist().
  i(QueryName, TableName, Proplist) ->
    {Fields, Values, Args} = lists:foldl(
      fun({K, V}, {Fs, Vs, Args}) ->
        {[escape(K)|Fs], [V|Vs], ["?"|Args]}
      end,
      {[], [], []},
      Proplist
    ),
    [
      "INSERT IGNORE INTO ", escape(TableName), " (", string:join(Fields, ","), ") ",
      "VALUES (", string:join(Args, ","),")"
    ].
  
  %% @doc UPDATE.
  -spec u(atom(), string(), proplists:proplist(), proplists:proplist()) -> iolist().
  u(QueryName, TableName, UpdateFields, WhereFields) ->
    {WFields, WValues} = lists:foldl(
      fun({K, V}, {Fs, Vs}) ->
        {[escape(K) ++ "=?"|Fs], [V|Vs]}
  
negative.code:     WhereFields
    ),
    Where = string:join(WFields, " AND "),
    {["DELETE FROM ", escape(TableName), " WHERE ", Where], WValues}.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %%% Private API.
  