Commit 1aeaf744 authored by yiwenshao's avatar yiwenshao

able to use test_parser_helper

parent 1a67972c
#include <string>
#include <iostream>
#include <vector>
#include <functional>
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include <main/Connect.hh>
#include <main/rewrite_util.hh>
#include <main/sql_handler.hh>
#include <main/dml_handler.hh>
#include <main/ddl_handler.hh>
#include <main/CryptoHandlers.hh>
#include "parser/sql_utils.hh"
#include "parser/lex_util.hh"
#include "parser/embedmysql.hh"
#include "util/util.hh"
#include "util/constants.hh"
#include "parser/showparser_helper.hh"
#include "parser/lex_util.hh"
static void show_item(const Item* const i);
static
void
show_item_field(const Item_field &i) {
std::cout<<"i.field_name: "<<i.field_name<<std::endl;
}
static
void
show_item_sum(const Item_sum_sum &i) {
const unsigned int arg_count = RiboldMYSQL::get_arg_count(i);
std::cout<<arg_count<<std::endl;
const Item *const child_item = RiboldMYSQL::get_arg(i, 0);
show_item(child_item);
}
void
show_item(const Item * const i) {
switch (i->type()){
case Item::FIELD_ITEM: {
show_item_field(static_cast<const Item_field&>(*i));
break;
}
case Item::SUM_FUNC_ITEM: {
show_item_sum(static_cast<const Item_sum_sum &>(*i));
break;
}
case Item::INT_ITEM: {
break;
}
case Item::STRING_ITEM:{
break;
}
default:{
std::cout<<"unknown type"<<std::endl;
}
}
}
static
void
show_table_list(const List<TABLE_LIST> &tll) {
//alias or nested join
}
#include "test_parser_helper/showparser.hh"
#include "test_parser_helper/showitem.hh"
#include "test_parser_helper/showselect_lex.hh"
/*
static
void
show_select_lex(const st_select_lex &select_lex) {
......@@ -85,7 +26,7 @@ show_select_lex(const st_select_lex &select_lex) {
std::cout<<SHOW::ITEM::trans[item->type()]<<std::endl;
show_item(item);
}
}
}*/
static std::string embeddedDir="/t/cryt/shadow";
......
OBJDIRS += test_parser_helper
TESTPARSERHELPERSRC := filter.cc showparser.cc showitem.cc
TESTPARSERHELPERSRC := filter.cc showparser.cc showitem.cc showselect_lex.cc
all: $(OBJDIR)/libedbtest_parser_helper.so
......
#include <iostream>//this can not be placed below showitem.hh, why?
#include "test_parser_helper/showitem.hh"
Item* data=NULL;
void
show_item_field(const Item_field &i) {
std::cout<<"i.field_name: "<<i.field_name<<std::endl;
}
void
show_item_sum(const Item_sum_sum &i) {
const unsigned int arg_count = const_cast<Item_sum_sum &>(i).get_arg_count();
std::cout<<arg_count<<std::endl;
const Item *const child_item = const_cast<Item_sum_sum &>(i).get_arg(0);
show_item(child_item);
}
void
show_item(const Item * const i) {
switch (i->type()){
case Item::FIELD_ITEM: {
show_item_field(static_cast<const Item_field&>(*i));
break;
}
case Item::SUM_FUNC_ITEM: {
show_item_sum(static_cast<const Item_sum_sum &>(*i));
break;
}
case Item::INT_ITEM: {
break;
}
case Item::STRING_ITEM:{
break;
}
default:{
std::cout<<"unknown type"<<std::endl;
}
}
}
......@@ -2,4 +2,16 @@
#include <map>
#include <string>
#include <sql_parse.h>
#include <mysql.h>
//#include <mysql.h>
//#include <sql_select.h>
//#include <sql_delete.h>
//#include <sql_insert.h>
//#include <sql_update.h>
//#include <item.h>
void
show_item_field(const Item_field &i);
void
show_item_sum(const Item_sum_sum &i);
void
show_item(const Item *const i);
#include <iostream>
#include "test_parser_helper/showselect_lex.hh"
#include "test_parser_helper/showparser.hh"
#include "test_parser_helper/showitem.hh"
void
show_table_list(const List<TABLE_LIST> &tll) {
//alias or nested join
}
void
show_select_lex(const st_select_lex &select_lex) {
show_table_list(select_lex.top_join_list);
auto item_it =
List_iterator<Item>(const_cast<List<Item> &>(select_lex.item_list));
for(;;) {
const Item *const item = item_it++;
if (!item)
break;
std::cout<<SHOW::ITEM::trans[item->type()]<<std::endl;
show_item(item);
}
}
#pragma once
#include <map>
#include <string>
#include <sql_parse.h>
void
show_table_list(const List<TABLE_LIST> &tll);
void
show_select_lex(const st_select_lex &select_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