Proper use of the ext_pdo implementation of query rewrite mechanism, should fix a couple of small bugs with prepared statements in emulated mode and also usage of cursors (which still needs alot of tests)