Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cpplib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-cpplib
Commits
6f470c60
Commit
6f470c60
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Add switch for type of retrieve response
parent
d5818c16
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
ENH: Support FIND and COUNT queries
Pipeline
#11562
canceled
3 years ago
Stage: info
Stage: setup
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/caosdb/transaction.h
+1
-1
1 addition, 1 deletion
include/caosdb/transaction.h
src/caosdb/transaction.cpp
+21
-5
21 additions, 5 deletions
src/caosdb/transaction.cpp
with
22 additions
and
6 deletions
include/caosdb/transaction.h
+
1
−
1
View file @
6f470c60
...
...
@@ -405,7 +405,7 @@ private:
MultiTransactionRequest
*
request
;
mutable
MultiTransactionResponse
*
response
;
std
::
string
error_message
;
int
query_count
;
mutable
long
query_count
;
};
template
<
class
InputIterator
>
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/transaction.cpp
+
21
−
5
View file @
6f470c60
...
...
@@ -96,6 +96,8 @@ using caosdb::entity::v1alpha1::MultiTransactionRequest;
using
caosdb
::
entity
::
v1alpha1
::
MultiTransactionResponse
;
using
WrappedResponseCase
=
caosdb
::
entity
::
v1alpha1
::
TransactionResponse
::
WrappedResponseCase
;
using
QueryResponseCase
=
caosdb
::
entity
::
v1alpha1
::
RetrieveResponse
::
QueryResponseCase
;
using
caosdb
::
utility
::
get_arena
;
using
grpc
::
ClientAsyncResponseReader
;
using
ProtoEntity
=
caosdb
::
entity
::
v1alpha1
::
Entity
;
...
...
@@ -303,12 +305,26 @@ auto Transaction::WaitForIt() const noexcept -> TransactionStatus {
auto
*
responses
=
this
->
response
->
mutable_responses
(
0
);
switch
(
responses
->
wrapped_response_case
())
{
case
WrappedResponseCase
::
kRetrieveResponse
:
{
auto
*
entity
=
responses
->
mutable_retrieve_response
()
->
release_entity
();
if
(
!
entity
->
errors
().
empty
())
{
this
->
status
=
TransactionStatus
::
TRANSACTION_ERROR
(
"The request returned with errors."
);
auto
*
retrieve_response
=
responses
->
mutable_retrieve_response
();
switch
(
retrieve_response
->
query_response_case
())
{
case
QueryResponseCase
::
kEntity
:
{
auto
*
entity
=
retrieve_response
->
release_entity
();
if
(
!
entity
->
errors
().
empty
())
{
this
->
status
=
TransactionStatus
::
TRANSACTION_ERROR
(
"The request returned with errors."
);
}
this
->
result_set
=
std
::
make_unique
<
UniqueResult
>
(
entity
);
}
break
;
case
QueryResponseCase
::
kSelectResult
:
{
// TODO(tf) Select queries
}
break
;
case
QueryResponseCase
::
kCountResult
:
{
this
->
query_count
=
retrieve_response
->
count_result
();
}
break
;
default
:
// TODO(tf) Error
break
;
}
this
->
result_set
=
std
::
make_unique
<
UniqueResult
>
(
entity
);
}
break
;
case
WrappedResponseCase
::
kUpdateResponse
:
{
auto
*
updatedIdResponse
=
responses
->
mutable_update_response
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment