Created
February 11, 2010 16:56
-
-
Save posulliv/301690 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @file Defines the API for a QueryRewriter. | |
*/ | |
namespace drizzled | |
{ | |
namespace plugin | |
{ | |
/** | |
* Class which rewrites queries | |
*/ | |
class QueryRewriter : public Plugin | |
{ | |
public: | |
explicit QueryRewriter(std::string name_arg) | |
: | |
Plugin(name_arg, "QueryRewriter") | |
{} | |
virtual ~QueryRewriter() {} | |
/** | |
* Rewrite a query in the form of a std::string | |
* | |
* @param[out] to_rewrite string representing the query to rewrite | |
*/ | |
virtual void rewrite(std::string &to_rewrite)= 0; | |
static bool addPlugin(QueryRewriter *in_rewriter); | |
static void removePlugin(QueryRewriter *in_rewriter); | |
/** | |
* Take a query to be rewritten and go through all the rewriters that are registered as plugins | |
* and let the enabled ones rewrite they query. | |
* TODO: does it make sense to have multiple rewriters? | |
* | |
* @param[out] to_rewrite string representing the query to rewrite | |
*/ | |
static void rewriteQuery(std::string &to_rewrite); | |
private: | |
QueryRewriter(); | |
QueryRewriter(const QueryRewriter&); | |
QueryRewriter& operator=(const QueryRewriter&); | |
}; | |
} /* namespace plugin */ | |
} /* namespace drizzled */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment