Typed static queries

I'm opening this PR so we can discuss the current state of the implementation.
Should print some details from the SQLException here (maybe toString or even printStackTrace)