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
a88dd320
Commit
a88dd320
authored
Jan 07, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function StringToItem in parser/sql_util.cc
parent
e4f54f44
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
26 deletions
+11
-26
test_insertHandler.cc
debug/test_insertHandler.cc
+3
-25
sql_utils.cc
parser/sql_utils.cc
+7
-0
sql_utils.hh
parser/sql_utils.hh
+1
-1
No files found.
debug/test_insertHandler.cc
View file @
a88dd320
...
...
@@ -12,26 +12,8 @@
#include <main/CryptoHandlers.hh>
static
std
::
string
embeddedDir
=
"/t/cryt/shadow"
;
/*
//Show what Analysis can do
static void test_Analysis(Analysis & analysis){
//oDET,
//oOPE,
//oAGG,
std::cout<<GREEN_BEGIN<<"USE Analysis: "<<COLOR_END<<std::endl;
OnionMeta *om = analysis.getOnionMeta2("tdb","student","id",oDET);
if(om!=NULL)
std::cout<<"use analysis.getOnionMetae oDET: "<<om->getAnonOnionName()<<std::endl;
om = analysis.getOnionMeta2("tdb","student","id",oOPE);
if(om!=NULL)
std::cout<<"use analysis.getOnionMetae oOPE: "<<om->getAnonOnionName()<<std::endl;
om = analysis.getOnionMeta2("tdb","student","id",oAGG);
if(om!=NULL)
std::cout<<"use analysis.getOnionMetae oAGG: "<<om->getAnonOnionName()<<std::endl;
}*/
static
void
myTestCreateTableHandler
(
std
::
string
query
){
static
void
testInsertHandler
(
std
::
string
query
){
std
::
unique_ptr
<
Connect
>
e_conn
(
Connect
::
getEmbedded
(
embeddedDir
));
std
::
unique_ptr
<
SchemaInfo
>
schema
(
new
SchemaInfo
());
std
::
function
<
DBMeta
*
(
DBMeta
*
const
)
>
loadChildren
=
...
...
@@ -48,9 +30,6 @@ static void myTestCreateTableHandler(std::string query){
//just like what we do in Rewrite::rewrite,dispatchOnLex
Analysis
analysis
(
std
::
string
(
"tdb"
),
*
schema
,
TK
,
SECURITY_RATING
::
SENSITIVE
);
//assert(analysis.getMasterKey().get()!=NULL);
//assert(getKey(std::string("113341234"))!=NULL);
//test_Analysis(analysis);
DMLHandler
*
h
=
new
InsertHandler
();
...
...
@@ -59,8 +38,7 @@ static void myTestCreateTableHandler(std::string query){
new
query_parse
(
"tdb"
,
query
));
LEX
*
const
lex
=
p
->
lex
();
auto
executor
=
h
->
transformLex
(
analysis
,
lex
);
std
::
cout
<<
((
DMLQueryExecutor
*
)
executor
)
->
getQuery
()
<<
std
::
endl
;
std
::
cout
<<
((
DMLQueryExecutor
*
)
executor
)
->
getQuery
()
<<
std
::
endl
;
}
int
...
...
@@ -78,7 +56,7 @@ main() {
std
::
vector
<
std
::
string
>
querys
{
query1
};
for
(
auto
item
:
querys
){
std
::
cout
<<
item
<<
std
::
endl
;
myTestCreateTable
Handler
(
item
);
testInsert
Handler
(
item
);
std
::
cout
<<
std
::
endl
;
}
return
0
;
...
...
parser/sql_utils.cc
View file @
a88dd320
...
...
@@ -68,3 +68,10 @@ printItemToString(const Item &i){
return
o
.
str
();
}
Item
*
StringToItem
(
std
::
string
s
){
return
new
(
current_thd
->
mem_root
)
Item_string
(
make_thd_string
(
s
),
s
.
length
(),
&
my_charset_bin
);
}
parser/sql_utils.hh
View file @
a88dd320
...
...
@@ -45,4 +45,4 @@ char * make_thd_string(const std::string &s, size_t *lenp = 0);
std
::
string
ItemToString
(
const
Item
&
i
);
std
::
string
printItemToString
(
const
Item
&
i
);
Item
*
StringToItem
(
std
::
string
);
//added
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