Bug #28563
closedIncorrect handler detected with DELETE, INSERT and UPDATE queries
100%
Description
exec_DELETEquery(), exec_INSERTquery() and exec_UPDATEquery() (maybe others too) fail to use the correct handler. exec_SELECTquery() and exec_SELECTgetRows() work correctly when used with an extra MySQL database, but I suspect that it fails when using a different DBMS.
The problem is that the handler ($this->lastHandlerKey) is selected based on the not-yet-mapped table(s) instead of the mapped table name(s). Inside SELECTquery() this operation is repeated with the mapped table name, so in the end it will select the right handler if both the default handler and the correct handler are 'native' (MySQL).
DELETEquery() does not set the lastHandlerKey again and will thus use the default handler.
INSERTquery() and UPDATEquery() analyse the handler again, but set a local variable with the result; the query will be executed by the default handler.
Solution would be to select the handler in the exec_* family of functions based on the mapped table name(s) and not the original table name(s).