convert LIMIT to parameter

LIMIT and OFFSET are not supported by all database platforms. We therefore added them as parameters to `OC_DB::prepare( $query , $limit=null, $offset=null )`

@karlitschek @DeepDiver1975 @icewind1991 

Originally part of https://github.com/owncloud/core/pull/3583

Sidenote: I will submit a PR with a new `OC_DB::executeAudited (...)` call that will do some sanity and error checks that will log the wrong usage of SQL and throw a `DatabasException` to make all developers aware of issues with their SQL.