Autoincrement compatibilty fix for Windows

I made this patch before that set an auto-increment column on the Model to the last inserted id. Having tested it on Windows now, it unfortunately failed there since there were some SELECTs made to detect the auto-increment column directly after the INSERT. For some reason the last insert id could be retrieved even after a SELECT on Linux (or possibly an older Mysql version.)

So here's a patched version that works on both Linux and Windows.