Use RETURNING in database INSERT queries; remove legacy MySQL helper function.