Added shortcuts for raw sql usage and a minor optimization of the query compiler.

I often need to use Raw SQL when interacting with legacy systems and this pull requests makes it a bit faster to do so when coding.

I also made a small change to the query compiler. Not sure if its noticeably faster but its a bit cleaner.

Every change is tested and 100% backwards compatible.