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
8af51224
Commit
8af51224
authored
Oct 16, 2017
by
Casualet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add mbk
parent
18c1275c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
4 deletions
+30
-4
mbk.cc
main/mbk.cc
+30
-4
No files found.
main/mbk.cc
View file @
8af51224
...
...
@@ -104,13 +104,14 @@ static std::map<std::string, WrapperState*> clients;
Connect
*
globalConn
;
//Return values got by using directly the MySQL c Client
struct
rawReturnValue
{
std
::
vector
<
std
::
vector
<
std
::
string
>
>
rowValues
;
struct
rawReturnValue
{
std
::
vector
<
std
::
vector
<
std
::
string
>>
rowValues
;
std
::
vector
<
std
::
string
>
fieldNames
;
std
::
vector
<
enum_field_types
>
fieldTypes
;
std
::
vector
<
int
>
lengths
;
std
::
vector
<
int
>
maxlengths
;
std
::
vector
<
int
>
choosen_onions
;
void
show
(){
cout
<<
"rowvalues:"
<<
endl
;
for
(
auto
item_vec
:
rowValues
){
...
...
@@ -119,10 +120,12 @@ struct rawReturnValue{
}
cout
<<
endl
;
}
cout
<<
"types:"
<<
endl
;
for
(
auto
item
:
fieldTypes
){
cout
<<
IS_NUM
(
item
)
<<
"
\t
"
;
}
cout
<<
endl
;
cout
<<
"fieldNames:"
<<
endl
;
for
(
auto
item
:
fieldNames
){
...
...
@@ -865,13 +868,34 @@ static meta_file load_meta(string filename){
}
static
void
write_row_data
(
rawReturnValue
&
resraw
){
vector
<
FILE
*>
data_files
;
for
(
auto
item
:
resraw
.
fieldNames
){
item
=
string
(
"data/"
)
+
item
;
FILE
*
data
=
fopen
(
item
.
c_str
(),
"w"
);
data_files
.
push_back
(
data
);
}
const
string
token
=
"
\n
"
;
for
(
auto
&
item
:
resraw
.
rowValues
){
for
(
unsigned
int
i
=
0u
;
i
<
item
.
size
();
i
++
){
fwrite
(
item
[
i
].
c_str
(),
1
,
item
[
i
].
size
(),
data_files
[
i
]);
if
(
IS_NUM
(
resraw
.
fieldTypes
[
i
])){
fwrite
(
token
.
c_str
(),
1
,
token
.
size
(),
data_files
[
i
]);
}
}
}
for
(
auto
item
:
data_files
){
fclose
(
item
);
}
}
static
void
write_raw_data_to_files
(
rawReturnValue
&
resraw
,
string
db
,
string
table
){
//write metafiles
write_meta
(
resraw
,
db
,
table
);
//write datafiles
write_row_data
(
resraw
);
}
/*
...
...
@@ -879,6 +903,8 @@ rawReturnValue load_raw_data_from_files(){
}*/
...
...
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