refactored convert2dasql to be inside cms_query_rewriter
issues #65 and #77.