Commit 1b498abb authored by yiwenshao's avatar yiwenshao

abel to get selectlext back

parent 1aeaf744
...@@ -11,22 +11,7 @@ ...@@ -11,22 +11,7 @@
#include "test_parser_helper/showparser.hh" #include "test_parser_helper/showparser.hh"
#include "test_parser_helper/showitem.hh" #include "test_parser_helper/showitem.hh"
#include "test_parser_helper/showselect_lex.hh" #include "test_parser_helper/showselect_lex.hh"
/* #include "test_parser_helper/showstring.hh"
static
void
show_select_lex(const st_select_lex &select_lex) {
show_table_list(select_lex.top_join_list);
auto item_it =
RiboldMYSQL::constList_iterator<Item>(select_lex.item_list);
for(;;) {
const Item *const item = item_it++;
if (!item)
break;
UNUSED(item);
std::cout<<SHOW::ITEM::trans[item->type()]<<std::endl;
show_item(item);
}
}*/
static std::string embeddedDir="/t/cryt/shadow"; static std::string embeddedDir="/t/cryt/shadow";
...@@ -49,7 +34,7 @@ int main() { ...@@ -49,7 +34,7 @@ int main() {
LEX *const lex = p->lex(); LEX *const lex = p->lex();
std::cout<<SHOW::SQLCOM::trans[lex->sql_command]<<std::endl; std::cout<<SHOW::SQLCOM::trans[lex->sql_command]<<std::endl;
show_select_lex(lex->select_lex); show_select_lex(lex->select_lex);
UNUSED(lex); std::cout<<get_lex_string(*lex)<<std::endl;
} }
return 0; return 0;
} }
OBJDIRS += test_parser_helper OBJDIRS += test_parser_helper
TESTPARSERHELPERSRC := filter.cc showparser.cc showitem.cc showselect_lex.cc TESTPARSERHELPERSRC := filter.cc showparser.cc showitem.cc showselect_lex.cc showstring.cc
all: $(OBJDIR)/libedbtest_parser_helper.so all: $(OBJDIR)/libedbtest_parser_helper.so
......
#include "test_parser_helper/showstring.hh"
static
std::string
get_select_lex_unit_string( SELECT_LEX_UNIT &select_lex_unit) {
String s;
select_lex_unit.print(&s, QT_ORDINARY);
return std::string(s.ptr(), s.length());
}
std::string
get_lex_string(LEX &lex) {
String s;
THD *t = current_thd;
(void)t;
switch(lex.sql_command) {
case SQLCOM_SELECT:
return get_select_lex_unit_string(lex.unit);
break;
default:
return "unimplemented";
}
return "hehe";
}
#pragma once
#include <string>
#include <sql_parse.h>
std::string
get_lex_string(LEX &lex);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment