Implement limiting of results

Added support for limiting the number of results from a query. this
is implemented by filtering the results ruturned from the Query on the db
Not really much use on this comment as we can't do a native limit right now given the query might be multiple SQL queries. If we do some optimisation for queries which only need a single SQL query at some point, I'm sure we'll do this.