[DBAgentMySQL] Fix a problem in which getLastInsertId() doesn't work on upsert.

According to http://dev.mysql.com/doc/refman/5.1/en/insert-on-duplicate.html
Prior to MySQL 5.1.12, it's necessary to do workaround like this
patch.