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
445dbb86
Commit
445dbb86
authored
Jun 09, 2017
by
casualet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test_schema.cc able to show the hierachy of metadata
parent
9c3abfb5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
20 deletions
+32
-20
test_schema.cc
main/test_schema.cc
+32
-20
No files found.
main/test_schema.cc
View file @
445dbb86
/*
used to check to schema info of all the current databases
*/
#include <cstdlib>
#include <cstdio>
#include <string>
...
...
@@ -59,53 +64,60 @@ static void processLayers(const EncLayer &enc){
static
void
processOnionMeta
(
const
OnionMeta
&
onion
){
std
::
cout
<<
GREEN_BEGIN
<<
"PRINT OnionMeta"
<<
COLOR_END
<<
std
::
endl
;
std
::
cout
<<
"onionmeta->getAnonOnionName(): "
<<
onion
.
getAnonOnionName
()
<<
std
::
endl
;
static
void
processOnionMeta
(
const
OnionMeta
&
onion
,
std
::
string
pre
=
"
\t\t\t
"
){
//
std::cout<<GREEN_BEGIN<<"PRINT OnionMeta"<<COLOR_END<<std::endl;
//
std::cout<<"onionmeta->getAnonOnionName(): "<<onion.getAnonOnionName()<<std::endl;
auto
&
layers
=
onion
.
getLayers
();
for
(
auto
&
slayer
:
layers
){
std
::
cout
<<
pre
;
processLayers
(
*
(
slayer
.
get
()));
}
}
static
void
processFieldMeta
(
const
FieldMeta
&
field
){
std
::
cout
<<
GREEN_BEGIN
<<
"PRINT FieldMeta"
<<
COLOR_END
<<
std
::
endl
;
static
void
processFieldMeta
(
const
FieldMeta
&
field
,
std
::
string
pre
=
"
\t\t
"
){
//
std::cout<<GREEN_BEGIN<<"PRINT FieldMeta"<<COLOR_END<<std::endl;
for
(
const
auto
&
onion
:
field
.
getChildren
()){
std
::
cout
<<
onion
.
second
->
getDatabaseID
()
<<
":"
<<
onion
.
first
.
getValue
()
<<
std
::
endl
;
std
::
cout
<<
pre
;
//std::cout<<onion.second->getDatabaseID()<<":"<<onion.first.getValue()<<std::endl;
std
::
cout
<<
onion
.
second
->
getAnonOnionName
()
<<
std
::
endl
;
processOnionMeta
(
*
(
onion
.
second
));
}
}
static
void
processTableMeta
(
const
TableMeta
&
table
){
std
::
cout
<<
GREEN_BEGIN
<<
"PRINT TableMeta"
<<
COLOR_END
<<
std
::
endl
;
static
void
processTableMeta
(
const
TableMeta
&
table
,
std
::
string
pre
=
"
\t
"
){
//
std::cout<<GREEN_BEGIN<<"PRINT TableMeta"<<COLOR_END<<std::endl;
for
(
const
auto
&
field
:
table
.
getChildren
()){
std
::
cout
<<
"fieldmeta->stringify: "
<<
field
.
second
->
stringify
()
<<
std
::
endl
;
std
::
cout
<<
"fieldmeta->stringify: "
<<
field
.
second
->
getFieldName
()
<<
std
::
endl
;
std
::
cout
<<
field
.
second
->
getDatabaseID
()
<<
":"
<<
field
.
first
.
getValue
()
<<
std
::
endl
;
std
::
cout
<<
pre
;
//std::cout<<"fieldmeta->stringify: "<<field.second->stringify()<<std::endl;
std
::
cout
<<
field
.
second
->
getFieldName
()
<<
std
::
endl
;
//std::cout<<field.second->getDatabaseID()<<":"<<field.first.getValue()<<std::endl;
processFieldMeta
(
*
(
field
.
second
));
}
}
static
void
processDatabaseMeta
(
const
DatabaseMeta
&
db
)
{
std
::
cout
<<
GREEN_BEGIN
<<
"PRINT DatabaseMeta"
<<
COLOR_END
<<
std
::
endl
;
static
void
processDatabaseMeta
(
const
DatabaseMeta
&
db
,
std
::
string
pre
=
""
)
{
//
std::cout<<GREEN_BEGIN<<"PRINT DatabaseMeta"<<COLOR_END<<std::endl;
for
(
const
auto
&
table
:
db
.
getChildren
()){
std
::
cout
<<
table
.
second
->
getDatabaseID
()
<<
":"
<<
table
.
first
.
getValue
()
<<
":"
<<
table
.
first
.
getSerial
()
<<
std
::
endl
;
std
::
cout
<<
"tableMeta->getAnonTableName: "
<<
table
.
second
->
getAnonTableName
()
<<
std
::
endl
;
std
::
cout
<<
pre
;
//std::cout<<table.second->getDatabaseID()<<":"<<table.first.getValue()<<":"<<
// table.first.getSerial()<<std::endl;
std
::
cout
<<
"tableMeta->getAnonTableName: "
<<
table
.
second
->
getAnonTableName
()
<<
" : "
<<
table
.
first
.
getValue
()
<<
std
::
endl
;
processTableMeta
(
*
(
table
.
second
));
}
}
static
void
processSchemaInfo
(
SchemaInfo
&
schema
){
static
void
processSchemaInfo
(
SchemaInfo
&
schema
,
std
::
string
pre
=
""
){
//we have a map here
std
::
cout
<<
GREEN_BEGIN
<<
"PRINT SchemaInfo"
<<
COLOR_END
<<
std
::
endl
;
//
std::cout<<GREEN_BEGIN<<"PRINT SchemaInfo"<<COLOR_END<<std::endl;
//only const auto & is allowed, now copying. or we meet use of deleted function.
for
(
const
auto
&
child
:
schema
.
getChildren
())
{
std
::
cout
<<
child
.
second
->
getDatabaseID
()
<<
":"
<<
child
.
first
.
getValue
()
<<
":"
<<
child
.
first
.
getSerial
()
<<
std
::
endl
;
//std::cout<<child.second->getDatabaseID()<<":"<<child.first.getValue()<<":"<<
// child.first.getSerial()<<std::endl;
//std::cout<<GREEN_BEGIN<<child.first.getValue()<<COLOR_END<<std::endl;
std
::
cout
<<
child
.
first
.
getValue
()
<<
std
::
endl
;
processDatabaseMeta
(
*
(
child
.
second
));
}
}
...
...
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