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
11ceb5d5
Commit
11ceb5d5
authored
Jan 17, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
c4267e97
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
1 deletion
+51
-1
reuse.cc
wrapper/reuse.cc
+47
-0
reuse.hh
wrapper/reuse.hh
+4
-1
No files found.
wrapper/reuse.cc
View file @
11ceb5d5
...
@@ -278,3 +278,50 @@ void transform_to_rawMySQLReturnValue(rawMySQLReturnValue & str,ResType & item )
...
@@ -278,3 +278,50 @@ void transform_to_rawMySQLReturnValue(rawMySQLReturnValue & str,ResType & item )
}
}
str
.
fieldTypes
=
item
.
types
;
str
.
fieldTypes
=
item
.
types
;
}
}
rawMySQLReturnValue
executeAndGetResultRemote
(
Connect
*
curConn
,
std
::
string
query
){
std
::
unique_ptr
<
DBResult
>
dbres
;
curConn
->
execute
(
query
,
&
dbres
);
rawMySQLReturnValue
myRaw
;
if
(
dbres
==
nullptr
||
dbres
->
n
==
NULL
){
std
::
cout
<<
"no results"
<<
std
::
endl
;
return
myRaw
;
}
int
num
=
mysql_num_rows
(
dbres
->
n
);
int
numOfFields
=
mysql_num_fields
(
dbres
->
n
);
MYSQL_FIELD
*
field
;
MYSQL_ROW
row
;
if
(
num
!=
0
){
while
(
(
row
=
mysql_fetch_row
(
dbres
->
n
))
){
//what's the difference between fieldlen
unsigned
long
*
fieldLen
=
mysql_fetch_lengths
(
dbres
->
n
);
std
::
vector
<
std
::
string
>
curRow
;
for
(
int
i
=
0
;
i
<
numOfFields
;
i
++
){
if
(
i
==
0
)
{
while
(
(
field
=
mysql_fetch_field
(
dbres
->
n
))
)
{
myRaw
.
fieldNames
.
push_back
(
std
::
string
(
field
->
name
));
myRaw
.
fieldTypes
.
push_back
(
field
->
type
);
//myRaw.lengths.push_back(field->length);
//myRaw.lengths.push_back(fieldLen[i]);
myRaw
.
lengths
.
push_back
(
field
->
max_length
);
myRaw
.
maxlengths
.
push_back
(
field
->
max_length
);
//cout<<field->length<<"::"<<field->max_length<<endl;
}
}
if
(
row
[
i
]
==
NULL
)
curRow
.
push_back
(
"NULL"
);
else
curRow
.
push_back
(
std
::
string
(
row
[
i
],
fieldLen
[
i
]));
}
myRaw
.
rowValues
.
push_back
(
curRow
);
}
}
return
myRaw
;
}
wrapper/reuse.hh
View file @
11ceb5d5
...
@@ -83,5 +83,8 @@ ResType decryptResults(const ResType &dbres, const ReturnMeta &rmeta);
...
@@ -83,5 +83,8 @@ ResType decryptResults(const ResType &dbres, const ReturnMeta &rmeta);
std
::
vector
<
FieldMeta_Wrapper
>
FieldMeta_to_Wrapper
(
std
::
vector
<
FieldMeta
*>
pfms
);
std
::
vector
<
FieldMeta_Wrapper
>
FieldMeta_to_Wrapper
(
std
::
vector
<
FieldMeta
*>
pfms
);
void
transform_to_rawMySQLReturnValue
(
rawMySQLReturnValue
&
str
,
ResType
&
item
);
void
transform_to_rawMySQLReturnValue
(
rawMySQLReturnValue
&
str
,
ResType
&
item
);
rawMySQLReturnValue
executeAndGetResultRemote
(
Connect
*
curConn
,
std
::
string
query
);
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