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
ab3b448f
Commit
ab3b448f
authored
Jan 05, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add field sql_type to FieldMeta
parent
9c993074
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
26 deletions
+37
-26
Embed
Embed
+0
-0
Makefrag
main/Makefrag
+4
-4
dml_handler.cc
main/dml_handler.cc
+5
-6
load_and_store.cc
main/load_and_store.cc
+8
-6
schema.cc
main/schema.cc
+9
-4
schema.hh
main/schema.hh
+7
-2
.mydumper.c.swp
packages/tls/mydumper/.mydumper.c.swp
+0
-0
Makefrag
util/Makefrag
+4
-4
No files found.
Embed
0 → 100755
View file @
ab3b448f
File added
main/Makefrag
View file @
ab3b448f
...
@@ -32,10 +32,10 @@ $(OBJDIR)/libcryptdb.so: $(CRYPTDB_OBJS) \
...
@@ -32,10 +32,10 @@ $(OBJDIR)/libcryptdb.so: $(CRYPTDB_OBJS) \
#
install: install_main
install: install_main
#
.PHONY: install_main
.PHONY: install_main
#
install_main: $(OBJDIR)/libcryptdb.so
install_main: $(OBJDIR)/libcryptdb.so
#
install -m 644 $(OBJDIR)/libcryptdb.so /usr/lib
install -m 644 $(OBJDIR)/libcryptdb.so /usr/lib
# vim: set noexpandtab:
# vim: set noexpandtab:
main/dml_handler.cc
View file @
ab3b448f
...
@@ -160,7 +160,7 @@ void InsertHandler::gather(Analysis &a, LEX *const lex) const {
...
@@ -160,7 +160,7 @@ void InsertHandler::gather(Analysis &a, LEX *const lex) const {
// Values
// Values
// -----------------
// -----------------
if
(
lex
->
many_values
.
head
())
{
if
(
lex
->
many_values
.
head
())
{
//
开始处理
many values
//
start processing
many values
auto
it
=
List_iterator
<
List_item
>
(
lex
->
many_values
);
auto
it
=
List_iterator
<
List_item
>
(
lex
->
many_values
);
List
<
List_item
>
newList
;
List
<
List_item
>
newList
;
for
(;;)
{
for
(;;)
{
...
@@ -178,7 +178,7 @@ void InsertHandler::gather(Analysis &a, LEX *const lex) const {
...
@@ -178,7 +178,7 @@ void InsertHandler::gather(Analysis &a, LEX *const lex) const {
// > INSERT INTO <table> () VALUES ();
// > INSERT INTO <table> () VALUES ();
// > INSERT INTO <table> VALUES ();
// > INSERT INTO <table> VALUES ();
}
else
{
}
else
{
//li
指向了lex->many_values的迭代内容
//li
pointer to items of lex->many_values
auto
it0
=
List_iterator
<
Item
>
(
*
li
);
auto
it0
=
List_iterator
<
Item
>
(
*
li
);
auto
fmVecIt
=
fmVec
.
begin
();
auto
fmVecIt
=
fmVec
.
begin
();
...
@@ -188,8 +188,8 @@ void InsertHandler::gather(Analysis &a, LEX *const lex) const {
...
@@ -188,8 +188,8 @@ void InsertHandler::gather(Analysis &a, LEX *const lex) const {
if
(
!
i
)
{
if
(
!
i
)
{
break
;
break
;
}
}
//
获得values中的内容,并且通过fieldMeta好帮助完成rewrite工作
//
fetch values, and use fieldMeta to facilitate rewrite
//
每个field都要进行洋葱的加密.
//
every filed should be encrypted with onions of encryption
rewriteInsertHelper
(
*
i
,
**
fmVecIt
,
a
,
newList0
);
rewriteInsertHelper
(
*
i
,
**
fmVecIt
,
a
,
newList0
);
++
fmVecIt
;
++
fmVecIt
;
}
}
...
@@ -202,8 +202,7 @@ void InsertHandler::gather(Analysis &a, LEX *const lex) const {
...
@@ -202,8 +202,7 @@ void InsertHandler::gather(Analysis &a, LEX *const lex) const {
new_lex
->
many_values
=
newList
;
new_lex
->
many_values
=
newList
;
}
}
//for queries with ON DUPLICATE KEY UPDATE
//对于普通的insert, 这部分的内容不会用到的.
// -----------------------
// -----------------------
// ON DUPLICATE KEY UPDATE
// ON DUPLICATE KEY UPDATE
// -----------------------
// -----------------------
...
...
main/load_and_store.cc
View file @
ab3b448f
...
@@ -308,7 +308,8 @@ static std::unique_ptr<SchemaInfo> myLoadSchemaInfo() {
...
@@ -308,7 +308,8 @@ static std::unique_ptr<SchemaInfo> myLoadSchemaInfo() {
//load all metadata and then store it in schema
//load all metadata and then store it in schema
loadChildren
(
schema
.
get
());
loadChildren
(
schema
.
get
());
Analysis
analysis
(
std
::
string
(
"student"
),
*
schema
,
std
::
unique_ptr
<
AES_KEY
>
(
getKey
(
std
::
string
(
"113341234"
))),
Analysis
analysis
(
std
::
string
(
"student"
),
*
schema
,
std
::
unique_ptr
<
AES_KEY
>
(
getKey
(
std
::
string
(
"113341234"
))),
SECURITY_RATING
::
SENSITIVE
);
SECURITY_RATING
::
SENSITIVE
);
return
schema
;
return
schema
;
}
}
...
@@ -652,7 +653,6 @@ static meta_file load_meta(string db="tdb", string table="student", string filen
...
@@ -652,7 +653,6 @@ static meta_file load_meta(string db="tdb", string table="student", string filen
return
res
;
return
res
;
}
}
static
void
write_row_data
(
rawMySQLReturnValue
&
resraw
,
string
db
,
string
table
){
static
void
write_row_data
(
rawMySQLReturnValue
&
resraw
,
string
db
,
string
table
){
vector
<
FILE
*>
data_files
;
vector
<
FILE
*>
data_files
;
string
prefix
=
string
(
"data/"
)
+
db
+
"/"
+
table
+
"/"
;
string
prefix
=
string
(
"data/"
)
+
db
+
"/"
+
table
+
"/"
;
...
@@ -835,8 +835,10 @@ static void construct_insert(rawMySQLReturnValue & str,std::string table,std::ve
...
@@ -835,8 +835,10 @@ static void construct_insert(rawMySQLReturnValue & str,std::string table,std::ve
if
(
IS_NUM
(
str
.
fieldTypes
[
j
]))
{
if
(
IS_NUM
(
str
.
fieldTypes
[
j
]))
{
cout
<<
str
.
fieldTypes
[
j
]
<<
endl
;
cout
<<
str
.
fieldTypes
[
j
]
<<
endl
;
cur
+=
str
.
rowValues
[
i
][
j
]
+=
","
;
cur
+=
str
.
rowValues
[
i
][
j
]
+=
","
;
cout
<<
"isnum"
<<
endl
;
}
else
{
}
else
{
cur
+=
string
(
"
\"
"
)
+=
str
.
rowValues
[
i
][
j
]
+=
"
\"
,"
;
cur
+=
string
(
"
\"
"
)
+=
str
.
rowValues
[
i
][
j
]
+=
"
\"
,"
;
cout
<<
"notnum"
<<
endl
;
}
}
}
}
cur
.
back
()
=
')'
;
cur
.
back
()
=
')'
;
...
@@ -862,12 +864,12 @@ main(int argc, char* argv[]) {
...
@@ -862,12 +864,12 @@ main(int argc, char* argv[]) {
}
}
init
();
init
();
std
::
string
option
(
argv
[
1
]);
std
::
string
option
(
argv
[
1
]);
std
::
string
db
=
"tdb
2"
,
table
=
"stu
"
;
std
::
string
db
=
"tdb
"
,
table
=
"student
"
;
if
(
option
==
"store"
){
if
(
option
==
"store"
){
store
(
db
,
table
);
store
(
db
,
table
);
}
else
if
(
option
==
"load"
){
}
else
if
(
option
==
"load"
){
auto
res
=
load_files
(
db
,
table
);
ResType
res
=
load_files
(
db
,
table
);
rawMySQLReturnValue
str
;
rawMySQLReturnValue
str
;
add
(
str
,
res
);
add
(
str
,
res
);
std
::
vector
<
string
>
res_query
;
std
::
vector
<
string
>
res_query
;
...
...
main/schema.cc
View file @
ab3b448f
...
@@ -226,7 +226,7 @@ std::unique_ptr<FieldMeta>
...
@@ -226,7 +226,7 @@ std::unique_ptr<FieldMeta>
FieldMeta
::
deserialize
(
unsigned
int
id
,
const
std
::
string
&
serial
)
{
FieldMeta
::
deserialize
(
unsigned
int
id
,
const
std
::
string
&
serial
)
{
assert
(
id
!=
0
);
assert
(
id
!=
0
);
const
auto
vec
=
unserialize_string
(
serial
);
const
auto
vec
=
unserialize_string
(
serial
);
assert
(
9
==
vec
.
size
());
assert
(
10
==
vec
.
size
());
//We add one item,so there are ten items now
const
std
::
string
fname
=
vec
[
0
];
const
std
::
string
fname
=
vec
[
0
];
const
bool
has_salt
=
string_to_bool
(
vec
[
1
]);
const
bool
has_salt
=
string_to_bool
(
vec
[
1
]);
...
@@ -239,10 +239,13 @@ FieldMeta::deserialize(unsigned int id, const std::string &serial) {
...
@@ -239,10 +239,13 @@ FieldMeta::deserialize(unsigned int id, const std::string &serial) {
const
bool
has_default
=
string_to_bool
(
vec
[
7
]);
const
bool
has_default
=
string_to_bool
(
vec
[
7
]);
const
std
::
string
default_value
=
vec
[
8
];
const
std
::
string
default_value
=
vec
[
8
];
enum
enum_field_types
sql_type
=
((
enum
enum_field_types
)
atoi
(
vec
[
9
].
c_str
()));
//new field added
return
std
::
unique_ptr
<
FieldMeta
>
return
std
::
unique_ptr
<
FieldMeta
>
(
new
FieldMeta
(
id
,
fname
,
has_salt
,
salt_name
,
onion_layout
,
(
new
FieldMeta
(
id
,
fname
,
has_salt
,
salt_name
,
onion_layout
,
sec_rating
,
uniq_count
,
counter
,
has_default
,
sec_rating
,
uniq_count
,
counter
,
has_default
,
default_value
));
default_value
,
sql_type
));
}
}
// first element is the levels that the onionmeta should implement
// first element is the levels that the onionmeta should implement
...
@@ -333,7 +336,7 @@ FieldMeta::FieldMeta(const Create_field &field,
...
@@ -333,7 +336,7 @@ FieldMeta::FieldMeta(const Create_field &field,
sec_rating
(
sec_rating
),
uniq_count
(
uniq_count
),
counter
(
0
),
sec_rating
(
sec_rating
),
uniq_count
(
uniq_count
),
counter
(
0
),
has_default
(
determineHasDefault
(
field
)),
has_default
(
determineHasDefault
(
field
)),
default_value
(
determineDefaultValue
(
has_default
,
field
))
{
default_value
(
determineDefaultValue
(
has_default
,
field
))
{
sql_type
=
field
.
sql_type
;
//added by shaoyiwen
TEST_TextMessageError
(
init_onions_layout
(
m_key
,
this
,
field
,
unique
),
TEST_TextMessageError
(
init_onions_layout
(
m_key
,
this
,
field
,
unique
),
"Failed to build onions for new FieldMeta!"
);
"Failed to build onions for new FieldMeta!"
);
}
}
...
@@ -343,6 +346,7 @@ std::string FieldMeta::serialize(const DBObject &parent) const
...
@@ -343,6 +346,7 @@ std::string FieldMeta::serialize(const DBObject &parent) const
const
std
::
string
&
serialized_salt_name
=
const
std
::
string
&
serialized_salt_name
=
true
==
this
->
has_salt
?
serialize_string
(
getSaltName
())
true
==
this
->
has_salt
?
serialize_string
(
getSaltName
())
:
serialize_string
(
""
);
:
serialize_string
(
""
);
std
::
string
sql_type_string
=
std
::
to_string
((
int
)
sql_type
);
const
std
::
string
serial
=
const
std
::
string
serial
=
serialize_string
(
fname
)
+
serialize_string
(
fname
)
+
serialize_string
(
bool_to_string
(
has_salt
))
+
serialize_string
(
bool_to_string
(
has_salt
))
+
...
@@ -352,7 +356,8 @@ std::string FieldMeta::serialize(const DBObject &parent) const
...
@@ -352,7 +356,8 @@ std::string FieldMeta::serialize(const DBObject &parent) const
serialize_string
(
std
::
to_string
(
uniq_count
))
+
serialize_string
(
std
::
to_string
(
uniq_count
))
+
serialize_string
(
std
::
to_string
(
counter
))
+
serialize_string
(
std
::
to_string
(
counter
))
+
serialize_string
(
bool_to_string
(
has_default
))
+
serialize_string
(
bool_to_string
(
has_default
))
+
serialize_string
(
default_value
);
serialize_string
(
default_value
)
+
serialize_string
(
sql_type_string
);
//added by shaoyiwen
return
serial
;
return
serial
;
}
}
...
...
main/schema.hh
View file @
ab3b448f
...
@@ -99,12 +99,13 @@ public:
...
@@ -99,12 +99,13 @@ public:
const
std
::
string
&
salt_name
,
onionlayout
onion_layout
,
const
std
::
string
&
salt_name
,
onionlayout
onion_layout
,
SECURITY_RATING
sec_rating
,
unsigned
long
uniq_count
,
SECURITY_RATING
sec_rating
,
unsigned
long
uniq_count
,
uint64_t
counter
,
bool
has_default
,
uint64_t
counter
,
bool
has_default
,
const
std
::
string
&
default_value
)
const
std
::
string
&
default_value
,
enum
enum_field_types
in_sql_type
)
:
MappedDBMeta
(
id
),
fname
(
fname
),
salt_name
(
salt_name
),
:
MappedDBMeta
(
id
),
fname
(
fname
),
salt_name
(
salt_name
),
onion_layout
(
onion_layout
),
has_salt
(
has_salt
),
onion_layout
(
onion_layout
),
has_salt
(
has_salt
),
sec_rating
(
sec_rating
),
uniq_count
(
uniq_count
),
sec_rating
(
sec_rating
),
uniq_count
(
uniq_count
),
counter
(
counter
),
has_default
(
has_default
),
counter
(
counter
),
has_default
(
has_default
),
default_value
(
default_value
)
{
default_value
(
default_value
)
,
sql_type
(
in_sql_type
)
{
}
}
~
FieldMeta
()
{;}
~
FieldMeta
()
{;}
...
@@ -144,7 +145,11 @@ private:
...
@@ -144,7 +145,11 @@ private:
const
bool
has_default
;
const
bool
has_default
;
const
std
::
string
default_value
;
const
std
::
string
default_value
;
//added
enum
enum_field_types
sql_type
;
SECLEVEL
getOnionLevel
(
onion
o
)
const
;
SECLEVEL
getOnionLevel
(
onion
o
)
const
;
enum_field_types
getSqlType
(){
return
sql_type
;}
static
onionlayout
determineOnionLayout
(
const
AES_KEY
*
const
m_key
,
static
onionlayout
determineOnionLayout
(
const
AES_KEY
*
const
m_key
,
const
Create_field
&
f
,
const
Create_field
&
f
,
...
...
packages/tls/mydumper/.mydumper.c.swp
deleted
100644 → 0
View file @
9c993074
File deleted
util/Makefrag
View file @
ab3b448f
...
@@ -9,11 +9,11 @@ $(OBJDIR)/libedbutil.so: $(patsubst %.cc,$(OBJDIR)/util/%.o,$(UTILSRC))
...
@@ -9,11 +9,11 @@ $(OBJDIR)/libedbutil.so: $(patsubst %.cc,$(OBJDIR)/util/%.o,$(UTILSRC))
$(OBJDIR)/libedbutil.a: $(patsubst %.cc,$(OBJDIR)/util/%.o,$(UTILSRC))
$(OBJDIR)/libedbutil.a: $(patsubst %.cc,$(OBJDIR)/util/%.o,$(UTILSRC))
$(AR) r $@ $^
$(AR) r $@ $^
#
install: install_util
install: install_util
#
.PHONY: install_util
.PHONY: install_util
#
install_util: $(OBJDIR)/libedbutil.so
install_util: $(OBJDIR)/libedbutil.so
#
install -m 644 $(OBJDIR)/libedbutil.so /usr/lib
install -m 644 $(OBJDIR)/libedbutil.so /usr/lib
$(OBJDIR)/util/version.cc: always
$(OBJDIR)/util/version.cc: always
@mkdir -p $(@D)
@mkdir -p $(@D)
...
...
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