Revert "Refactored cake_query.erl"

This reverts commit c55d4da784254570fdc43c47d1d603829933315d.