Added pre/post query hooks. Note that non-hookable queries can be done on table names prefixed with '\!', that will be stripped later.