Named params and the option to return results as objects

I know it's an old edit but i thought you might want to have a look on it
 * added the option to return results as objects
 * added named parameters support

Most changes are in the prepareQuery() method