Skip to content

Instantly share code, notes, and snippets.

@johnbender
Created January 17, 2009 19:00
Show Gist options
  • Save johnbender/48416 to your computer and use it in GitHub Desktop.
Save johnbender/48416 to your computer and use it in GitHub Desktop.
format_query({parts, Table, Columns, Op, Ord})->
case {Table, Columns, Op, Ord} of
{{table, Name}, {columns, all}, Op, Ord} ->
format_query({parts, {Table, initcap(Name) ++ " || ", Op, Ord}});
{{table, Name}, Columns, Op, Ord} ->
format_query({parts,
{initcap(Name) ++ " <- mnesia:table(" ++ string:to_lower(Name) ++ ")",
Columns,
Op,
Ord}})
%% ... other cases ...
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment