Refactored mysqlGetPad() sproc code.