Looking again, I can see this addresses my concern about int casts. I still prefer to have the int casts inline with the SQL if possible -- it's easy to tell at a glance that it's being done. But the "if ($status)" part of the check looks like it's only relevant to optional parameters -- is it needed here if $status is not optional?