Query rewrite code

Unify all query rewrite code.
Break all commands down into indivual queries.
NpgsqlParse now takes a byte[] query string.