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
114f77df
Commit
114f77df
authored
Jan 15, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not need to call show databases in debug/load,instead we call create_embedded_thd
parent
6cede695
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
62 deletions
+7
-62
.common.hh.swp
debug/.common.hh.swp
+0
-0
load.cc
debug/load.cc
+7
-13
load.hh
debug/load.hh
+0
-49
No files found.
debug/.common.hh.swp
deleted
100644 → 0
View file @
6cede695
File deleted
debug/load.cc
View file @
114f77df
...
...
@@ -102,32 +102,25 @@ static ResType load_files(std::string db="tdb", std::string table="student"){
//to be
}
metadata_files
res_meta
=
load_meta
(
db
,
table
);
// for(unsigned int i=0;i<res_meta.dec_onion_index.size();i++){
//choosen onion for each field
// res[i].choosenOnions.push_back(res_meta.get_choosen_onions()[i]);
// }
std
::
shared_ptr
<
ReturnMeta
>
rm
=
getReturnMeta
(
fms
,
res
);
//why do we need this??
std
::
string
backq
=
"show databases"
;
executeAndGetResultRemote
(
globalConn
,
backq
);
create_embedded_thd
(
0
);
rawMySQLReturnValue
resraw
2
;
rawMySQLReturnValue
resraw
;
//load fields in the stored file
vector
<
vector
<
string
>>
res_field
=
load_table_fields
(
res_meta
);
resraw
2
.
rowValues
=
res_field
;
resraw
.
rowValues
=
res_field
;
auto
field_names
=
flat_vec
(
res_meta
.
selected_field_names
);
auto
field_types
=
flat_vec
(
res_meta
.
selected_field_types
);
auto
field_lengths
=
flat_vec
(
res_meta
.
selected_field_lengths
);
resraw2
.
fieldNames
=
field_names
;
// resraw2.choosen_onions = ;
resraw
.
fieldNames
=
field_names
;
for
(
unsigned
int
i
=
0
;
i
<
field_types
.
size
();
++
i
)
{
resraw
2
.
fieldTypes
.
push_back
(
static_cast
<
enum_field_types
>
(
field_types
[
i
]));
resraw
.
fieldTypes
.
push_back
(
static_cast
<
enum_field_types
>
(
field_types
[
i
]));
}
ResType
rawtorestype
=
MygetResTypeFromLuaTable
(
false
,
&
resraw
2
);
ResType
rawtorestype
=
MygetResTypeFromLuaTable
(
false
,
&
resraw
);
auto
finalresults
=
decryptResults
(
rawtorestype
,
*
rm
);
return
finalresults
;
}
...
...
@@ -135,6 +128,7 @@ static ResType load_files(std::string db="tdb", std::string table="student"){
int
main
(
int
argc
,
char
*
argv
[]){
init
();
create_embedded_thd
(
0
);
std
::
string
db
=
"tdb"
,
table
=
"student"
;
globalEsp
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
5000
);
if
(
globalEsp
==
NULL
){
...
...
debug/load.hh
View file @
114f77df
...
...
@@ -109,56 +109,7 @@ void rawMySQLReturnValue::show(){
cout
<<
endl
;
}
//must be static, or we get "no previous declaration"
//execute the query and get the rawReturnVale, this struct can be copied.
static
rawMySQLReturnValue
executeAndGetResultRemote
(
Connect
*
curConn
,
std
::
string
query
){
std
::
unique_ptr
<
DBResult
>
dbres
;
curConn
->
execute
(
query
,
&
dbres
);
rawMySQLReturnValue
myRaw
;
if
(
dbres
==
nullptr
||
dbres
->
n
==
NULL
){
std
::
cout
<<
"no results"
<<
std
::
endl
;
return
myRaw
;
}
int
num
=
mysql_num_rows
(
dbres
->
n
);
int
numOfFields
=
mysql_num_fields
(
dbres
->
n
);
MYSQL_FIELD
*
field
;
MYSQL_ROW
row
;
if
(
num
!=
0
){
while
(
(
row
=
mysql_fetch_row
(
dbres
->
n
))
){
//what's the difference between fieldlen
unsigned
long
*
fieldLen
=
mysql_fetch_lengths
(
dbres
->
n
);
std
::
vector
<
std
::
string
>
curRow
;
for
(
int
i
=
0
;
i
<
numOfFields
;
i
++
){
if
(
i
==
0
)
{
while
(
(
field
=
mysql_fetch_field
(
dbres
->
n
))
)
{
myRaw
.
fieldNames
.
push_back
(
std
::
string
(
field
->
name
));
myRaw
.
fieldTypes
.
push_back
(
field
->
type
);
//myRaw.lengths.push_back(field->length);
//myRaw.lengths.push_back(fieldLen[i]);
myRaw
.
lengths
.
push_back
(
field
->
max_length
);
myRaw
.
maxlengths
.
push_back
(
field
->
max_length
);
//cout<<field->length<<"::"<<field->max_length<<endl;
}
}
if
(
row
[
i
]
==
NULL
)
curRow
.
push_back
(
"NULL"
);
else
curRow
.
push_back
(
std
::
string
(
row
[
i
],
fieldLen
[
i
]));
}
myRaw
.
rowValues
.
push_back
(
curRow
);
}
}
return
myRaw
;
}
//helper function for transforming the rawMySQLReturnValue
static
Item_null
*
make_null
(
const
std
::
string
&
name
=
""
){
char
*
const
n
=
current_thd
->
strdup
(
name
.
c_str
());
...
...
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