Make use of getGeneratedKeys in lastInsertedId.

This allows us to do the necessary hackery for MySQL which reports the
generated key as GENERATED_KEY instead of via its actual column name.