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
81f02949
Commit
81f02949
authored
Feb 28, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add more test_parser
parent
3221c489
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
1 deletion
+75
-1
.rewrite_sum.cc.swp
main/.rewrite_sum.cc.swp
+0
-0
startMultipleInstance.sh
startMultipleInstance.sh
+0
-1
select.cc
test_parser/select.cc
+75
-0
No files found.
main/.rewrite_sum.cc.swp
0 → 100644
View file @
81f02949
File added
startMultipleInstance.sh
View file @
81f02949
...
@@ -20,4 +20,3 @@ for((i=1;i<=$numOfInstance;i++));do
...
@@ -20,4 +20,3 @@ for((i=1;i<=$numOfInstance;i++));do
cd
-
cd
-
done
done
test_parser/select.cc
View file @
81f02949
...
@@ -14,8 +14,81 @@
...
@@ -14,8 +14,81 @@
#include "util/util.hh"
#include "util/util.hh"
#include "util/constants.hh"
#include "util/constants.hh"
#include "parser/showparser_helper.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
}
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"
;
int
main
()
{
int
main
()
{
char
*
buffer
;
char
*
buffer
;
if
((
buffer
=
getcwd
(
NULL
,
0
))
==
NULL
){
if
((
buffer
=
getcwd
(
NULL
,
0
))
==
NULL
){
...
@@ -27,12 +100,14 @@ int main() {
...
@@ -27,12 +100,14 @@ int main() {
std
::
string
line
;
std
::
string
line
;
std
::
ifstream
infile
(
filename
);
std
::
ifstream
infile
(
filename
);
while
(
std
::
getline
(
infile
,
line
))
{
while
(
std
::
getline
(
infile
,
line
))
{
std
::
cout
<<
"=================================================================="
<<
std
::
endl
;
std
::
cout
<<
line
<<
std
::
endl
;
std
::
cout
<<
line
<<
std
::
endl
;
std
::
unique_ptr
<
query_parse
>
p
;
std
::
unique_ptr
<
query_parse
>
p
;
p
=
std
::
unique_ptr
<
query_parse
>
(
p
=
std
::
unique_ptr
<
query_parse
>
(
new
query_parse
(
"tdb"
,
line
));
new
query_parse
(
"tdb"
,
line
));
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
);
UNUSED
(
lex
);
UNUSED
(
lex
);
}
}
return
0
;
return
0
;
...
...
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