Allow sorting results using a single index

This commit adds a simple SQL-based sorting
implementation to CloudantQueryObjc.

The user specifies a sort document:

[ { fieldName: asc }, { fieldName2: desc } ]

The implementation looks for an index containing
fieldName and fieldName2, failing if one isn't found.
It then generates a SQL query to get the ordered
doc IDs:

SELECT DISTINCT _id FROM idxtable ORDER BY
   fieldName1 ASC, fieldName2 DESC

It then loops through the results of the sort
query, adding each docid which matches the
user's query to an array, ending up with a
list of the docids which match the user's query
in the correct order. Skip and limit are then
applied.

This isn't efficient, but works for all result set
sizes.

Fixes #9.
Fix using offset and limit where limit goes beyond array bounds
Use consistent validation of sort and field documents
Merge pull request #18 from cloudant/9-sort-results

Simple sorting implemention