Return 0 instead of 1 if lastInsertId doesn't work.