#include <ParserWrapper.h>
Definition at line 69 of file ParserWrapper.h.
Enumerator |
---|
Insert |
|
Delete |
|
Update |
|
NotDML |
|
Definition at line 72 of file ParserWrapper.h.
72 :
int { Insert = 0, Delete, Update, NotDML };
Enumerator |
---|
Unknown |
|
Read |
|
Write |
|
SchemaRead |
|
SchemaWrite |
|
Definition at line 74 of file ParserWrapper.h.
74 { Unknown, Read, Write, SchemaRead, SchemaWrite };
ParserWrapper::ParserWrapper |
( |
std::string |
query_string | ) |
|
Definition at line 104 of file ParserWrapper.cpp.
References ExplainInfo::isOtherExplain(), update_dml_cmd, and anonymous_namespace{ParserWrapper.cpp}::validate_no_leading_comments().
110 for (std::string ddl :
ddl_cmd) {
111 if (boost::istarts_with(query_string, ddl)) {
115 if (ddl ==
"CREATE") {
116 boost::regex ctas_regex{
117 R
"(CREATE\s+(TEMPORARY\s+|\s*)+TABLE.*(\"|\s)AS(\(|\s)+(SELECT|WITH).*)",
118 boost::regex::extended | boost::regex::icase};
119 if (boost::regex_match(query_string, ctas_regex)) {
122 }
else if (ddl ==
"COPY") {
125 boost::regex copy_to{R
"(COPY\s*\(([^#])(.+)\)\s+TO\s+.*)",
126 boost::regex::extended | boost::regex::icase};
127 if (boost::regex_match(query_string, copy_to)) {
133 }
else if (ddl ==
"SHOW") {
135 }
else if (ddl ==
"KILL") {
137 }
else if (ddl ==
"VALIDATE") {
141 }
else if (ddl ==
"ALTER") {
142 boost::regex alter_system_regex{R
"(ALTER\s+(SYSTEM|SESSION).*)",
143 boost::regex::extended | boost::regex::icase};
144 if (boost::regex_match(query_string, alter_system_regex)) {
147 }
else if (ddl ==
"ARCHIVE" || ddl ==
"DUMP") {
149 }
else if (ddl ==
"REFRESH") {
166 boost::regex itas_regex{R
"(INSERT\s+INTO\s+.*(\s+|\(|\")SELECT(\s|\(|\").*)",
167 boost::regex::extended | boost::regex::icase};
168 if (boost::regex_match(query_string, itas_regex)) {
void validate_no_leading_comments(const std::string &query_str)
bool isOtherExplain() const
static const std::vector< std::string > ddl_cmd
static const std::vector< std::string > update_dml_cmd
ParserWrapper::~ParserWrapper |
( |
| ) |
|
|
virtual |
DMLType ParserWrapper::getDMLType |
( |
| ) |
const |
|
inline |
QueryType ParserWrapper::getQueryType |
( |
| ) |
const |
|
inline |
bool ParserWrapper::isUpdateDelete |
( |
| ) |
const |
|
inline |
std::string ParserWrapper::process |
( |
std::string |
user, |
|
|
std::string |
passwd, |
|
|
std::string |
catalog, |
|
|
std::string |
sql_string, |
|
|
const bool |
legacy_syntax |
|
) |
| |
const std::vector< std::string > ParserWrapper::ddl_cmd |
|
staticprivate |
Initial value:= {"ARCHIVE",
"ALTER",
"COPY",
"CREATE",
"DROP",
"DUMP",
"GRANT",
"KILL",
"OPTIMIZE",
"REFRESH",
"RENAME",
"RESTORE",
"REVOKE",
"SHOW",
"TRUNCATE",
"REASSIGN",
"VALIDATE",
"CLEAR"}
Definition at line 106 of file ParserWrapper.h.
bool ParserWrapper::is_copy = false |
bool ParserWrapper::is_copy_to = false |
bool ParserWrapper::is_ctas = false |
bool ParserWrapper::is_ddl = false |
bool ParserWrapper::is_itas = false |
bool ParserWrapper::is_other_explain = false |
bool ParserWrapper::is_refresh = false |
bool ParserWrapper::is_update_dml = false |
bool ParserWrapper::is_validate = false |
const std::vector< std::string > ParserWrapper::update_dml_cmd |
|
staticprivate |
The documentation for this class was generated from the following files: