Fix mysql long GetLastInsertId

GetLastInsertId threw cast error when the returned value was ulong.
This was only visible when having a long Id field, triggering mysql
returning a ulong