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
483f2021
Commit
483f2021
authored
Oct 18, 2017
by
Casualet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
able to use res2 to parse data
parent
3fa97360
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
1 deletion
+58
-1
mbk.cc
main/mbk.cc
+58
-1
No files found.
main/mbk.cc
View file @
483f2021
...
...
@@ -867,7 +867,6 @@ static meta_file load_meta(string db="tdb", string table="student", string filen
}
string
item
=
types
.
substr
(
start
);
res
.
field_types
.
push_back
(
item
);
}
else
if
(
head
==
"field_lengths"
){
string
lengths
=
line
.
substr
(
index
+
1
);
int
start
=
0
,
next
=
0
;
...
...
@@ -1034,6 +1033,33 @@ static bool cmp(rawReturnValue &resraw){
return
true
;
}
void
static
cmp2
(
rawReturnValue
&
res1
,
rawReturnValue
&
res2
){
if
(
res1
.
fieldNames
==
res2
.
fieldNames
){
cout
<<
"field name pass"
<<
endl
;
}
else
{
cout
<<
"field name not pass"
<<
endl
;
}
if
(
res1
.
fieldTypes
==
res2
.
fieldTypes
){
cout
<<
"field types pass"
<<
endl
;
}
else
{
cout
<<
"field types not pass"
<<
endl
;
}
if
(
res1
.
rowValues
==
res2
.
rowValues
){
cout
<<
"row values pass"
<<
endl
;
}
else
{
cout
<<
"row values not pass"
<<
endl
;
}
if
(
res1
.
choosen_onions
==
res2
.
choosen_onions
){
cout
<<
"choosen onions pass"
<<
endl
;
}
else
{
cout
<<
"choosen onions not pass"
<<
endl
;
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -1251,6 +1277,37 @@ main(int argc, char* argv[]) {
ResType
rawtorestype
=
MygetResTypeFromLuaTable
(
false
,
&
resraw
);
auto
finalresults
=
decryptResults
(
rawtorestype
,
*
rm
);
parseResType
(
finalresults
);
}
else
{
std
::
string
db
=
"tdb"
,
table
=
"student"
;
std
::
unique_ptr
<
SchemaInfo
>
schema
=
myLoadSchemaInfo
();
//get all the fields in the tables.
std
::
vector
<
FieldMeta
*>
fms
=
getFieldMeta
(
*
schema
,
db
,
table
);
auto
res
=
getTransField
(
fms
);
meta_file
res_meta
=
load_meta
();
for
(
unsigned
int
i
=
0
;
i
<
res_meta
.
choosen_onions
.
size
();
i
++
){
res
[
i
].
choosenOnions
.
push_back
(
res_meta
.
choosen_onions
[
i
]);
}
std
::
shared_ptr
<
ReturnMeta
>
rm
=
getReturnMeta
(
fms
,
res
);
std
::
string
backq
=
getTestQuery
(
*
schema
,
res
,
db
,
table
);
rawReturnValue
resraw
=
executeAndGetResultRemote
(
globalConn
,
backq
);
for
(
auto
&
item
:
res
){
resraw
.
choosen_onions
.
push_back
(
item
.
choosenOnions
[
0
]);
}
rawReturnValue
resraw2
;
vector
<
vector
<
string
>>
res_field
=
load_table_fields
(
res_meta
);
resraw2
.
rowValues
=
res_field
;
resraw2
.
fieldNames
=
res_meta
.
field_names
;
resraw2
.
choosen_onions
=
res_meta
.
choosen_onions
;
for
(
unsigned
int
i
=
0
;
i
<
res_meta
.
field_types
.
size
();
++
i
){
resraw2
.
fieldTypes
.
push_back
(
static_cast
<
enum_field_types
>
(
std
::
stoi
(
res_meta
.
field_types
[
i
])));
}
cmp2
(
resraw
,
resraw2
);
ResType
rawtorestype
=
MygetResTypeFromLuaTable
(
false
,
&
resraw2
);
auto
finalresults
=
decryptResults
(
rawtorestype
,
*
rm
);
parseResType
(
finalresults
);
}
fclose
(
stream
);
return
0
;
...
...
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