Summary: See above Reviewers: buda, mislav.bradac Reviewed By: mislav.bradac Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D98
41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "logging/loggable.hpp"
|
|
#include "query/stripper.hpp"
|
|
|
|
/*
|
|
* Query preprocessing contains:
|
|
* * query stripping
|
|
*
|
|
* This class is here because conceptually process of query preprocessing
|
|
* might have more than one step + in current version of C++ standard
|
|
* isn't trivial to instantiate QueryStripper because of template arguments +
|
|
* it depends on underlying lexical analyser.
|
|
*
|
|
* The preprocessing results are:
|
|
* * stripped query |
|
|
* * stripped arguments |-> StrippedQuery
|
|
* * stripped query hash |
|
|
*/
|
|
class QueryPreprocessor : public Loggable {
|
|
public:
|
|
QueryPreprocessor() : Loggable("QueryPreprocessor") {}
|
|
|
|
/**
|
|
* Preprocess the query:
|
|
* * strip parameters
|
|
* * calculate query hash
|
|
*
|
|
* @param query that is going to be stripped
|
|
*
|
|
* @return QueryStripped object
|
|
*/
|
|
auto preprocess(const std::string &query) {
|
|
auto preprocessed = query::Strip(query);
|
|
logger.info("stripped_query = {}", preprocessed.query);
|
|
logger.info("query_hash = {}", preprocessed.hash);
|
|
|
|
return preprocessed;
|
|
}
|
|
};
|