One problem I seeIs that you do all this in the view controller, whereas you should do this in the model layer. Depending on how the view criteria is build (ignore nulls, required bind variables) the sql builder omits posts of the where clause.
What might happen is that one of your bind variables are set to null without your knowledge. To be sure that your variables are set correctly you need to log the message from the executeQuery method. a sample on how to do this can be found here http://wp.me/pcBZk-2d
Third method dumps the query and it's parameters.