fix %% in as_sql and sphinx_escaping