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
d6049088
Commit
d6049088
authored
Jan 24, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
able to limit count in final_load
parent
0df36de6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
21 deletions
+43
-21
global.constant
conf/global.constant
+1
-1
final_load.cc
debug/final_load.cc
+3
-2
constants.cc
util/constants.cc
+1
-1
constants.hh
util/constants.hh
+2
-3
reuse.cc
wrapper/reuse.cc
+26
-11
reuse.hh
wrapper/reuse.hh
+10
-3
No files found.
conf/global.constant
View file @
d6049088
loadCount:
1000000
loadCount:
3
other:1
debug/final_load.cc
View file @
d6049088
...
...
@@ -14,6 +14,7 @@
#include "wrapper/reuse.hh"
#include "wrapper/common.hh"
#include "wrapper/insert_lib.hh"
#include "util/constants.hh"
using
std
::
cout
;
using
std
::
cin
;
using
std
::
endl
;
...
...
@@ -136,9 +137,9 @@ void initGfb(std::vector<FieldMetaTrans> &res,std::string db,std::string table){
std
::
string
filename
=
prefix
+
gfb
.
field_names
[
i
];
std
::
vector
<
std
::
string
>
column
;
if
(
IS_NUM
(
gfb
.
field_types
[
i
])){
load_num_file
(
filename
,
column
);
load_num_file
_count
(
filename
,
column
,
constGlobalConstants
.
loadCount
);
}
else
{
load_string_file
(
filename
,
column
,
gfb
.
field_lengths
[
i
]
);
load_string_file
_count
(
filename
,
column
,
gfb
.
field_lengths
[
i
],
constGlobalConstants
.
loadCount
);
}
gfb
.
annoOnionNameToFileVector
[
gfb
.
field_names
[
i
]]
=
std
::
move
(
column
);
}
...
...
util/constants.cc
View file @
d6049088
...
...
@@ -8,7 +8,7 @@ const char *cryptdb_dir = getenv("CRYPTDB_DIR");
//assert(cryptdb_dir!=NULL);
const
globalConstants
constGlobalConstants
=
initGlobalConstants
();
globalConstants
initGlobalConstants
(){
printf
(
"%s"
,
cryptdb_dir
);
//
printf("%s",cryptdb_dir);
assert
(
cryptdb_dir
!=
NULL
);
assert
(
cryptdb_dir
[
0
]
==
'/'
);
std
::
string
prefix
=
std
::
string
(
cryptdb_dir
);
...
...
util/constants.hh
View file @
d6049088
...
...
@@ -8,13 +8,12 @@ added by et. all et related things.
#include <stdlib.h>
#include <stdio.h>
extern
const
char
*
cryptdb_dir
;
extern
const
int
gtoken
;
struct
globalConstants
{
int
loadCount
;
/*used to limit the number of final_load*/
};
extern
const
char
*
cryptdb_dir
;
extern
const
int
gtoken
;
extern
const
globalConstants
constGlobalConstants
;
globalConstants
initGlobalConstants
();
wrapper/reuse.cc
View file @
d6049088
...
...
@@ -438,17 +438,22 @@ void load_num_file(std::string filename,std::vector<std::string> &res){
}
infile
.
close
();
}
/*
void load_num_file(std::string filename,std::vector<Item> &res,enum_field_types intype){
void
load_num_file_count
(
std
::
string
filename
,
std
::
vector
<
std
::
string
>
&
res
,
int
count
)
{
std
::
ifstream
infile
(
filename
);
std
::
string
line
;
int
localCount
=
0
;
while
(
std
::
getline
(
infile
,
line
)){
res.pusb_back((void*)MySQLFieldTypeToItem(intype,line));
res
.
push_back
(
std
::
move
(
line
));
localCount
++
;
if
(
localCount
==
count
)
break
;
}
infile
.
close
();
}*/
}
void
load_string_file
(
std
::
string
filename
,
std
::
vector
<
std
::
string
>
&
res
,
unsigned
long
length
){
char
*
buf
=
new
char
[
length
];
...
...
@@ -457,20 +462,30 @@ void load_string_file(std::string filename, std::vector<std::string> &res,unsign
while
(
read
(
fd
,
buf
,
length
)
!=
0
){
res
.
push_back
(
std
::
move
(
std
::
string
(
buf
,
length
)));
}
delete
buf
;
close
(
fd
);
}
/*
void load_string_file(std::string filename,std::vector<void*> &res,unsigned long length,enum_field_types intype){
void
load_string_file_count
(
std
::
string
filename
,
std
::
vector
<
std
::
string
>
&
res
,
unsigned
long
length
,
int
count
)
{
char
*
buf
=
new
char
[
length
];
int
localCount
=
0
;
int
fd
=
open
(
filename
.
c_str
(),
O_RDONLY
);
if
(
fd
==-
1
)
assert
(
0
);
//reading from -1 may cause errors
while
(
read
(
fd
,
buf
,
length
)
!=
0
){
res.push_back((void*)MySQLFieldTypeToItem(intype,std::string(buf,length)));
res
.
push_back
(
std
::
move
(
std
::
string
(
buf
,
length
)));
localCount
++
;
if
(
localCount
==
count
)
break
;
}
delete
buf
;
close
(
fd
);
}
*/
std
::
ostream
&
insertManyValues
(
std
::
ostream
&
out
,
List
<
List_item
>
&
newList
){
...
...
wrapper/reuse.hh
View file @
d6049088
...
...
@@ -186,10 +186,17 @@ std::unique_ptr<Item>
getStringItem
(
std
::
string
s
);
//Item* do not work
//void load_num_file(std::string filename,std::vector<Item> &res,enum_field_types intype);
void
load_num_file_count
(
std
::
string
filename
,
std
::
vector
<
std
::
string
>
&
res
,
int
count
);
void
load_string_file_count
(
std
::
string
filename
,
std
::
vector
<
std
::
string
>
&
res
,
unsigned
long
length
,
int
count
);
//void load_string_file(std::string filename,std::vector<Item> &res,unsigned long length,enum_field_types intype);
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