fix fromlist spec
Merge pull request #49 from opscode/jc/fromlist-spec

fix fromlist spec
Fix handling of syntax error in queries

The execute_prepared function in sqerl_pgsql_client was not returning
the State record in the final fun head catching unrecognized errors such
as bad queries (either bad syntax or no such table).

In addition, the parse_error function was not flexible enough to allow
these messages through.
Add sqerl_rec:qfetch/3 fetch by named query returning record

This new function provides a convenient interface for custom defined
prepared queries that return records with a corresponding module
implementing the sqerl_rec behavior.

The qfetch function also cleans up some repitition among the fetch
functions.

Also added ensure_error to cleanup error returns and make sure they
are always of the form {error, Why}.
Add documentation for sqerl_rec
Add generated (via `make doc`) docs for github viewing
Merge branch 'sf/qfetch'
Have qfetch prepend RecName_ to the query name

This will reduce repetition and align the query name with that specified
in the record behaviour module.
Add gen_fetch, gen_delete query generators to exports

These functions can be useful for generating custom queries.

gen_fetch (renamed from gen_fetch_by) is enhanced to generate a multiple
"by" if a list of atoms is passed in. A query with multiple ANDs in the
WHERE clause is generated.

Also improving test coverage.
Merge branch 'sf/gen_fetch2'
Rework default queries: use first field

The default queries were bogus because they assumed a 'name' field. This
patch uses the first field in the record (really as returned by
RecName:'#info-'/1) as a unique column for use in single row UPDATE,
DELETE, and SELECT (fetch).

The fetch_all and fetch_page queries have been removed from the default
set, but the helper functions for generating these queries are now
exported.

When specifying query names, you can now provide a nested list of
atoms (iolist-esque, but just atoms) which will be joined into a single
atom with 'RecName_' prepended as before. This can be convenient for
programmatic query generation (see implementation of default_queries/1.

Add type export sqerl:atom_list() representing an atom or a deep list of
atoms.
Add doc to query gen functions
Update generated md docs
Merge branch 'sf/fix-defaults'
Make default update return updated record

The default update query is now an UPDATE ... RETURNING and returns the
updated record. This is useful to avoid a round trip when the db updates
some fields on UPDATE such as time stamps or sequences.

As part of this change, the qfetch function is enhanced as follows:

* handle RETURNING queries
* nice error message for query returning only count
* query name can be atom_list() (spec fix)

New function cquery is introduced for handling queries returning only a
count.

The delete function now uses cquery. Its return value changed
from ok to {ok, Count}.
update generated doc
Improve query_not_found error message

Include the name of the query that wasn't found!
Merge branch 'sf/update-returning'
Add scalar_fetch/3 to sqerl_rec

This is a convenience function that handles finding the appropriate
query based on the specified sqerl_rec callback module and transforming
the result to a list of values.
Add way to specify apps instead of modules for sqerl_rec translation