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
ba549a50
Commit
ba549a50
authored
May 20, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
load able to specify insert data
parent
f13bef30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
11 deletions
+29
-11
simple_load_new.cc
tools/simple_load_new.cc
+29
-11
No files found.
tools/simple_load_new.cc
View file @
ba549a50
...
@@ -26,6 +26,9 @@ using std::vector;
...
@@ -26,6 +26,9 @@ using std::vector;
using
std
::
string
;
using
std
::
string
;
using
std
::
to_string
;
using
std
::
to_string
;
static
std
::
string
embeddedDir
=
"/t/cryt/shadow"
;
static
std
::
string
embeddedDir
=
"/t/cryt/shadow"
;
std
::
string
base_embedded
=
"shadow"
;
std
::
string
base_read
=
"data"
;
char
*
globalEsp
=
NULL
;
char
*
globalEsp
=
NULL
;
int
num_of_pipe
=
4
;
int
num_of_pipe
=
4
;
//global map, for each client, we have one WrapperState which contains ProxyState.
//global map, for each client, we have one WrapperState which contains ProxyState.
...
@@ -53,7 +56,7 @@ static void init(){
...
@@ -53,7 +56,7 @@ static void init(){
if
((
buffer
=
getcwd
(
NULL
,
0
))
==
NULL
){
if
((
buffer
=
getcwd
(
NULL
,
0
))
==
NULL
){
perror
(
"getcwd error"
);
perror
(
"getcwd error"
);
}
}
embeddedDir
=
std
::
string
(
buffer
)
+
"/shadow"
;
embeddedDir
=
std
::
string
(
buffer
)
+
std
::
string
(
"/"
)
+
base_embedded
;
SharedProxyState
*
shared_ps
=
SharedProxyState
*
shared_ps
=
new
SharedProxyState
(
ci
,
embeddedDir
,
master_key
,
new
SharedProxyState
(
ci
,
embeddedDir
,
master_key
,
determineSecurityRating
());
determineSecurityRating
());
...
@@ -74,7 +77,7 @@ static
...
@@ -74,7 +77,7 @@ static
void
void
load_columns
(
std
::
vector
<
FieldMetaTrans
>
&
fmts
,
std
::
string
db
,
std
::
string
table
)
{
load_columns
(
std
::
vector
<
FieldMetaTrans
>
&
fmts
,
std
::
string
db
,
std
::
string
table
)
{
for
(
auto
&
item
:
fmts
){
for
(
auto
&
item
:
fmts
){
std
::
string
prefix
=
std
::
string
(
"data
/"
)
+
db
+
"/"
+
table
+
"/"
std
::
string
prefix
=
base_read
+
std
::
string
(
"
/"
)
+
db
+
"/"
+
table
+
"/"
+
item
.
getOriginalFieldMeta
()
->
getFieldName
()
+
"/"
;
+
item
.
getOriginalFieldMeta
()
->
getFieldName
()
+
"/"
;
//load onions for each field
//load onions for each field
for
(
unsigned
int
i
=
0u
;
i
<
item
.
getChoosenOnionName
().
size
();
i
++
){
for
(
unsigned
int
i
=
0u
;
i
<
item
.
getChoosenOnionName
().
size
();
i
++
){
...
@@ -280,19 +283,34 @@ List<Item> * processRow(const std::vector<Item *> &row,
...
@@ -280,19 +283,34 @@ List<Item> * processRow(const std::vector<Item *> &row,
return
newList0
;
return
newList0
;
}
}
static
std
::
map
<
std
::
string
,
std
::
string
>
parseArgv
(
int
argc
,
char
*
argv
[]){
POINT
assert
(
argc
%
2
==
1
);
std
::
map
<
std
::
string
,
std
::
string
>
res
;
for
(
int
i
=
1
;
i
<
argc
;){
res
[
std
::
string
(
argv
[
i
]
+
2
)]
=
std
::
string
(
argv
[
i
+
1
]);
i
+=
2
;
}
return
res
;
}
int
int
main
(
int
argc
,
char
*
argv
[]){
main
(
int
argc
,
char
*
argv
[]){
if
(
argc
<
2
){
std
::
cout
<<
"--db tdb --table student --base_embedded shadow --base_read data"
<<
std
::
endl
;
return
0
;
}
std
::
map
<
std
::
string
,
std
::
string
>
params
=
parseArgv
(
argc
,
argv
);
std
::
string
db
=
params
[
"db"
],
table
=
params
[
"table"
];
std
::
string
ip
=
"localhost"
;
base_embedded
=
params
[
"base_embedded"
];
base_read
=
params
[
"base_read"
];
timer
t_init
;
timer
t_init
;
init
();
init
();
create_embedded_thd
(
0
);
create_embedded_thd
(
0
);
std
::
string
db
=
"tdb"
,
table
=
"student"
;
std
::
string
ip
=
"localhost"
;
if
(
argc
==
4
){
ip
=
std
::
string
(
argv
[
1
]);
db
=
std
::
string
(
argv
[
2
]);
table
=
std
::
string
(
argv
[
3
]);
}
std
::
unique_ptr
<
SchemaInfo
>
schema
=
myLoadSchemaInfo
(
embeddedDir
);
std
::
unique_ptr
<
SchemaInfo
>
schema
=
myLoadSchemaInfo
(
embeddedDir
);
schema
.
get
();
schema
.
get
();
const
std
::
unique_ptr
<
AES_KEY
>
&
TK
=
std
::
unique_ptr
<
AES_KEY
>
(
getKey
(
std
::
string
(
"113341234"
)));
const
std
::
unique_ptr
<
AES_KEY
>
&
TK
=
std
::
unique_ptr
<
AES_KEY
>
(
getKey
(
std
::
string
(
"113341234"
)));
...
@@ -308,7 +326,7 @@ main(int argc, char* argv[]){
...
@@ -308,7 +326,7 @@ main(int argc, char* argv[]){
const
std
::
string
head
=
std
::
string
(
"INSERT INTO `"
)
+
db
+
"`.`"
+
annoTableName
+
"` "
;
const
std
::
string
head
=
std
::
string
(
"INSERT INTO `"
)
+
db
+
"`.`"
+
annoTableName
+
"` "
;
unsigned
int
i
=
0u
;
unsigned
int
i
=
0u
;
UNUSED
(
i
);
UNUSED
(
i
);
/*
while(true){
while
(
true
){
List
<
List_item
>
newList
;
List
<
List_item
>
newList
;
int
localCount
=
0
;
int
localCount
=
0
;
for
(;
i
<
res
.
rows
.
size
();
i
++
){
for
(;
i
<
res
.
rows
.
size
();
i
++
){
...
@@ -333,7 +351,7 @@ main(int argc, char* argv[]){
...
@@ -333,7 +351,7 @@ main(int argc, char* argv[]){
}
}
break
;
break
;
}
}
}
*/
}
UNUSED
(
load_files_new
);
UNUSED
(
load_files_new
);
UNUSED
(
processRow
);
UNUSED
(
processRow
);
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