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
c2584e9e
Commit
c2584e9e
authored
May 17, 2017
by
casualet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
able to generate simple query
parent
be4ac6f6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1104 additions
and
13 deletions
+1104
-13
Makefile
Makefile
+0
-2
Makefrag
main/Makefrag
+1
-1
cdb_test.cc
main/cdb_test.cc
+19
-10
mbk.cc
main/mbk.cc
+1084
-0
No files found.
Makefile
View file @
c2584e9e
...
...
@@ -71,12 +71,10 @@ always:
$(OBJDIR)/%.o
:
%.cc
@
mkdir
-p
$
(
@D
)
$(CXX)
-MD
$(CXXFLAGS)
-c
$<
-o
$@
echo
"11111111111111111111111"
$(OBJDIR)/%.o
:
$(OBJDIR)/%.cc
@
mkdir
-p
$
(
@D
)
$(CXX)
-MD
$(CXXFLAGS)
-c
$<
-o
$@
echo
"2222222222222222222222"
include
crypto/Makefrag
include
parser/Makefrag
...
...
main/Makefrag
View file @
c2584e9e
...
...
@@ -7,7 +7,7 @@ CRYPTDB_SRCS := schema.cc Translator.cc Connect.cc \
rewrite_func.cc rewrite_sum.cc metadata_tables.cc \
error.cc stored_procedures.cc rewrite_ds.cc rewrite_main.cc
CRYPTDB_PROGS:= cdb_test
CRYPTDB_PROGS:= cdb_test
mbk
CRYPTDBPROGOBJS := $(patsubst %,$(OBJDIR)/main/%,$(CRYPTDB_PROGS))
...
...
main/cdb_test.cc
View file @
c2584e9e
...
...
@@ -162,6 +162,7 @@ void printrawReturnValue(rawReturnValue & cur) {
std
::
cout
<<
"zero output"
<<
std
::
endl
;
return
;
}
if
(
static_cast
<
int
>
(
cur
.
fieldNames
.
size
())
!=
len
||
static_cast
<
int
>
(
cur
.
rowValues
[
0
].
size
())
!=
len
){
std
::
cout
<<
RED_BEGIN
<<
"size mismatch in printrawReturnValue"
<<
COLOR_END
<<
std
::
endl
;
return
;
...
...
@@ -196,14 +197,12 @@ bool myRewrite(std::string curQuery,unsigned long long _thread_id,std::string cl
assert
(
ps
);
c_wrapper
->
last_query
=
curQuery
;
std
::
cout
<<
RED_BEGIN
<<
"start my rewrite"
<<
COLOR_END
<<
std
::
endl
;
try
{
TEST_Text
(
retrieveDefaultDatabase
(
_thread_id
,
ps
->
getConn
(),
&
c_wrapper
->
default_db
),
"proxy failed to retrieve default database!"
);
const
std
::
shared_ptr
<
const
SchemaInfo
>
&
schema
=
ps
->
getSchemaInfo
();
c_wrapper
->
schema_info_refs
.
push_back
(
schema
);
std
::
unique_ptr
<
QueryRewrite
>
qr
=
std
::
unique_ptr
<
QueryRewrite
>
(
new
QueryRewrite
(
Rewriter
::
rewrite
(
curQuery
,
*
schema
.
get
(),
...
...
@@ -219,8 +218,7 @@ bool myRewrite(std::string curQuery,unsigned long long _thread_id,std::string cl
//helper function for transforming the rawReturnValue
static
Item_null
*
make_null
(
const
std
::
string
&
name
=
""
)
{
make_null
(
const
std
::
string
&
name
=
""
){
char
*
const
n
=
current_thd
->
strdup
(
name
.
c_str
());
return
new
Item_null
(
n
);
}
...
...
@@ -453,8 +451,10 @@ static std::vector<FieldMeta *> getFieldMeta(SchemaInfo &schema,std::string db =
}
}
//representation of one field.
struct
transField
{
bool
hasSalt
;
int
onionIndex
;
int
numOfOnions
;
//onions
std
::
vector
<
std
::
string
>
fields
;
...
...
@@ -873,12 +873,14 @@ backupOnionSelection generateBackupStrategy(std::string database, std::string ta
//one Olk for each field
backupOnionSelection
curBack
(
fields
.
size
());
int
fieldIndex
=
0
;
//according to uniqueCounter
for
(
FieldMeta
*
field
:
tbMeta
->
orderedFieldMetas
())
{
for
(
FieldMeta
*
field
:
tbMeta
->
orderedFieldMetas
()){
curBack
.
fieldSize
[
fieldIndex
]
=
field
->
getChildren
().
size
()
+
1
;
curBack
.
onionIndex
[
fieldIndex
]
=
0
;
fieldIndex
+=
1
;
}
//complete curBack
int
num
=
curBack
.
numOfFields
;
int
add
=
0
;
...
...
@@ -944,6 +946,7 @@ startBack(){
std
::
string
tablename
;
std
::
cin
>>
tablename
;
backupOnionSelection
curBack
=
generateBackupStrategy
(
dbname
,
tablename
,
*
schema
);
std
::
shared_ptr
<
ReturnMeta
>
rmeta
=
myGetReturnMeta
(
dbname
,
tablename
,
*
schema
,
curBack
);
std
::
string
selectQuery
=
logicBackUp
(
dbname
,
tablename
,
*
schema
);
...
...
@@ -957,6 +960,10 @@ startBack(){
}
}
int
main
()
{
gmp
[
SECLEVEL
::
INVALID
]
=
"INVALID"
;
...
...
@@ -968,8 +975,6 @@ main() {
gmp
[
SECLEVEL
::
SEARCH
]
=
"SEARCH"
;
gmp
[
SECLEVEL
::
HOM
]
=
"HOM"
;
gmp
[
SECLEVEL
::
RND
]
=
"RND"
;
gmp2
[
oDET
]
=
"oDET"
;
gmp2
[
oOPE
]
=
"oOPE"
;
gmp2
[
oAGG
]
=
"oAGG"
;
...
...
@@ -1017,10 +1022,14 @@ main() {
processSchemaInfo
(
*
schema
);
}
else
if
(
curQuery
==
"back"
){
std
::
unique_ptr
<
SchemaInfo
>
schema
=
myLoadSchemaInfo
();
auto
res
=
getTransField
(
getFieldMeta
(
*
schema
));
std
::
vector
<
FieldMeta
*>
fms
=
getFieldMeta
(
*
schema
);
auto
res
=
getTransField
(
fms
);
for
(
auto
&
item
:
res
){
item
.
show
();
}
}
else
{
std
::
cout
<<
GREEN_BEGIN
<<
"curQuery: "
<<
curQuery
<<
"
\n
"
<<
COLOR_END
<<
std
::
endl
;
batchTogether
(
client
,
curQuery
,
_thread_id
);
...
...
main/mbk.cc
0 → 100644
View file @
c2584e9e
This diff is collapsed.
Click to expand it.
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