Provide before() after() hooks for statement query/close/cancel - cherry-picked

Cherrypicked #242 from master with slight enhancement: distinguishes between ```statement.beforeExecuteQuery()``` and ```statement.beforeExecute()``` and ```statement.beforeExecuteQuery()``` and ```statement.beforeExecute()```