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
046afba1
Commit
046afba1
authored
Jan 19, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
able to use custom data in insert
parent
a5135821
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
5 deletions
+48
-5
final_load.cc
debug/final_load.cc
+22
-5
.common.cc.swp
wrapper/.common.cc.swp
+0
-0
reuse.cc
wrapper/reuse.cc
+19
-0
reuse.hh
wrapper/reuse.hh
+7
-0
No files found.
debug/final_load.cc
View file @
046afba1
...
@@ -128,6 +128,11 @@ void initGfb(std::vector<FieldMetaTrans> &res,std::string db,std::string table){
...
@@ -128,6 +128,11 @@ void initGfb(std::vector<FieldMetaTrans> &res,std::string db,std::string table){
}
}
gfb
.
annoOnionNameToFileVector
[
gfb
.
field_names
[
i
]]
=
std
::
move
(
column
);
gfb
.
annoOnionNameToFileVector
[
gfb
.
field_names
[
i
]]
=
std
::
move
(
column
);
}
}
//init another map
for
(
unsigned
int
i
=
0
;
i
<
gfb
.
field_names
.
size
();
i
++
){
gfb
.
annoOnionNameToType
[
gfb
.
field_names
[
i
]]
=
gfb
.
field_types
[
i
];
}
}
}
...
@@ -157,8 +162,8 @@ static ResType load_files(std::string db="tdb", std::string table="student"){
...
@@ -157,8 +162,8 @@ static ResType load_files(std::string db="tdb", std::string table="student"){
//load fields in the stored file
//load fields in the stored file
//Fast version
//Fast version
vector
<
vector
<
string
>>
resss_field
=
loadTableFieldsForDecryption
(
db
,
table
,
field_names
,
field_types
,
field_lengths
);
vector
<
vector
<
string
>>
resss_field
=
loadTableFieldsForDecryption
(
db
,
table
,
field_names
,
field_types
,
field_lengths
);
vector
<
vector
<
string
>>
res_field
;
vector
<
vector
<
string
>>
res_field
;
for
(
auto
item
:
field_names
){
for
(
auto
item
:
field_names
){
res_field
.
push_back
(
gfb
.
annoOnionNameToFileVector
[
item
]);
res_field
.
push_back
(
gfb
.
annoOnionNameToFileVector
[
item
]);
...
@@ -188,8 +193,7 @@ static ResType load_files(std::string db="tdb", std::string table="student"){
...
@@ -188,8 +193,7 @@ static ResType load_files(std::string db="tdb", std::string table="student"){
static
static
void
local_wrapper
(
const
Item
&
i
,
const
FieldMeta
&
fm
,
Analysis
&
a
,
void
local_wrapper
(
const
Item
&
i
,
const
FieldMeta
&
fm
,
Analysis
&
a
,
List
<
Item
>
*
const
append_list
){
List
<
Item
>
*
const
append_list
){
//为什么这里不是push item??
//append_list->push_back(&(const_cast<Item&>(i)));
// append_list->push_back(&(const_cast<Item&>(i)));
//do not use the plain strategy
//do not use the plain strategy
std
::
vector
<
Item
*>
l
;
std
::
vector
<
Item
*>
l
;
const
uint64_t
salt
=
fm
.
getHasSalt
()
?
randomValue
()
:
0
;
const
uint64_t
salt
=
fm
.
getHasSalt
()
?
randomValue
()
:
0
;
...
@@ -197,7 +201,20 @@ void local_wrapper(const Item &i, const FieldMeta &fm, Analysis &a,
...
@@ -197,7 +201,20 @@ void local_wrapper(const Item &i, const FieldMeta &fm, Analysis &a,
for
(
auto
it
:
fm
.
orderedOnionMetas
())
{
for
(
auto
it
:
fm
.
orderedOnionMetas
())
{
const
onion
o
=
it
.
first
->
getValue
();
const
onion
o
=
it
.
first
->
getValue
();
OnionMeta
*
const
om
=
it
.
second
;
OnionMeta
*
const
om
=
it
.
second
;
l
.
push_back
(
my_encrypt_item_layers
(
i
,
o
,
*
om
,
a
,
IV
));
std
::
string
annoOnionName
=
om
->
getAnonOnionName
();
if
(
gfb
.
annoOnionNameToFileVector
.
find
(
annoOnionName
)
!=
gfb
.
annoOnionNameToFileVector
.
end
()){
enum_field_types
type
=
static_cast
<
enum_field_types
>
(
gfb
.
annoOnionNameToType
[
annoOnionName
]);
if
(
IS_NUM
(
type
)){
std
::
string
in
(
"11"
);
l
.
push_back
(
MySQLFieldTypeToItem
(
type
,
in
));
}
else
{
std
::
string
in
(
"hehe"
);
l
.
push_back
(
MySQLFieldTypeToItem
(
type
,
in
));
}
//l.push_back(&(const_cast<Item&>(i)));
}
else
{
l
.
push_back
(
my_encrypt_item_layers
(
i
,
o
,
*
om
,
a
,
IV
));
}
}
}
if
(
fm
.
getHasSalt
())
{
if
(
fm
.
getHasSalt
())
{
l
.
push_back
(
new
Item_int
(
static_cast
<
ulonglong
>
(
salt
)));
l
.
push_back
(
new
Item_int
(
static_cast
<
ulonglong
>
(
salt
)));
...
...
wrapper/.common.cc.swp
deleted
100644 → 0
View file @
a5135821
File deleted
wrapper/reuse.cc
View file @
046afba1
...
@@ -459,3 +459,22 @@ insertManyValues(std::ostream &out,List<List_item> &newList){
...
@@ -459,3 +459,22 @@ insertManyValues(std::ostream &out,List<List_item> &newList){
return
out
;
return
out
;
}
}
std
::
unique_ptr
<
Item
>
getIntItem
(
int
i
){
Item
*
it
=
new
Item_int
(
i
);
return
std
::
unique_ptr
<
Item
>
(
it
);
}
std
::
unique_ptr
<
Item
>
getStringItem
(
std
::
string
s
){
Item
*
it
=
new
Item_string
(
make_thd_string
(
s
),
s
.
length
(),
&
my_charset_bin
);
return
std
::
unique_ptr
<
Item
>
(
it
);
}
wrapper/reuse.hh
View file @
046afba1
...
@@ -167,6 +167,7 @@ struct fullBackUp{
...
@@ -167,6 +167,7 @@ struct fullBackUp{
std
::
vector
<
int
>
field_types
;
std
::
vector
<
int
>
field_types
;
std
::
vector
<
int
>
field_lengths
;
std
::
vector
<
int
>
field_lengths
;
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
string
>>
annoOnionNameToFileVector
;
//field name to vector of string
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
string
>>
annoOnionNameToFileVector
;
//field name to vector of string
std
::
map
<
std
::
string
,
int
>
annoOnionNameToType
;
};
};
...
@@ -177,3 +178,9 @@ std::ostream&
...
@@ -177,3 +178,9 @@ std::ostream&
insertManyValues
(
std
::
ostream
&
out
,
List
<
List_item
>
&
newList
);
insertManyValues
(
std
::
ostream
&
out
,
List
<
List_item
>
&
newList
);
std
::
unique_ptr
<
Item
>
getIntItem
(
int
i
);
std
::
unique_ptr
<
Item
>
getStringItem
(
std
::
string
s
);
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