Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
Practical-Cryptdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zhaozhen
Practical-Cryptdb
Commits
1aeaf744
Commit
1aeaf744
authored
Mar 01, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
able to use test_parser_helper
parent
1a67972c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
70 deletions
+101
-70
select.cc
test_parser/select.cc
+8
-67
Makefrag
test_parser_helper/Makefrag
+1
-1
showitem.cc
test_parser_helper/showitem.cc
+44
-1
showitem.hh
test_parser_helper/showitem.hh
+13
-1
showselect_lex.cc
test_parser_helper/showselect_lex.cc
+24
-0
showselect_lex.hh
test_parser_helper/showselect_lex.hh
+11
-0
No files found.
test_parser/select.cc
View file @
1aeaf744
#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"
;
...
...
test_parser_helper/Makefrag
View file @
1aeaf744
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
...
...
test_parser_helper/showitem.cc
View file @
1aeaf744
#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
;
}
}
}
test_parser_helper/showitem.hh
View file @
1aeaf744
...
...
@@ -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
);
test_parser_helper/showselect_lex.cc
0 → 100644
View file @
1aeaf744
#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
);
}
}
test_parser_helper/showselect_lex.hh
0 → 100644
View file @
1aeaf744
#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
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment