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
a5b7293b
Verified
Commit
a5b7293b
authored
2 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
update cxxcaosdbcli
parent
3e3196e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!42
Release 0.2.0
,
!40
F dot in username
Pipeline
#24975
failed
2 years ago
Stage: info
Stage: setup
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/caosdb/connection.h
+4
-4
4 additions, 4 deletions
include/caosdb/connection.h
src/caosdb/connection.cpp
+4
-4
4 additions, 4 deletions
src/caosdb/connection.cpp
src/cxxcaosdbcli.cpp
+19
-16
19 additions, 16 deletions
src/cxxcaosdbcli.cpp
with
27 additions
and
24 deletions
include/caosdb/connection.h
+
4
−
4
View file @
a5b7293b
...
...
@@ -111,18 +111,18 @@ public:
*/
[[
nodiscard
]]
auto
ListRoles
()
const
->
std
::
vector
<
Role
>
;
[[
nodiscard
]]
auto
RetrieveSingleRole
(
std
::
string
name
)
const
->
Role
;
[[
nodiscard
]]
auto
RetrieveSingleRole
(
const
std
::
string
&
name
)
const
->
Role
;
auto
CreateSingleRole
(
const
Role
&
role
)
const
->
void
;
auto
DeleteSingleRole
(
std
::
string
name
)
const
->
void
;
auto
DeleteSingleRole
(
const
std
::
string
&
name
)
const
->
void
;
/**
* Retrieve a single user.
*/
// TODO(tf) find a way to deal with this:
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
[[
nodiscard
]]
auto
RetrieveSingleUser
(
std
::
string
realm
,
std
::
string
name
)
const
->
User
;
[[
nodiscard
]]
auto
RetrieveSingleUser
(
const
std
::
string
&
realm
,
const
std
::
string
&
name
)
const
->
User
;
/**
* Create a new user.
...
...
@@ -134,7 +134,7 @@ public:
*/
// TODO(tf) find a way to deal with this:
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
auto
DeleteSingleUser
(
std
::
string
realm
,
std
::
string
name
)
const
->
void
;
auto
DeleteSingleUser
(
const
std
::
string
&
realm
,
const
std
::
string
&
name
)
const
->
void
;
#endif
private
:
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/connection.cpp
+
4
−
4
View file @
a5b7293b
...
...
@@ -128,7 +128,7 @@ auto Connection::RetrieveVersionInfo() const -> const VersionInfo & {
}
#ifdef BUILD_ACM
[[
nodiscard
]]
auto
Connection
::
RetrieveSingleRole
(
std
::
string
name
)
const
->
Role
{
[[
nodiscard
]]
auto
Connection
::
RetrieveSingleRole
(
const
std
::
string
&
name
)
const
->
Role
{
RetrieveSingleRoleRequest
request
;
request
.
set_name
(
name
);
RetrieveSingleRoleResponse
response
;
...
...
@@ -156,7 +156,7 @@ auto Connection::RetrieveVersionInfo() const -> const VersionInfo & {
return
Role
(
std
::
make_unique
<
RoleImpl
>
(
role
));
}
auto
Connection
::
DeleteSingleRole
(
std
::
string
name
)
const
->
void
{
auto
Connection
::
DeleteSingleRole
(
const
std
::
string
&
name
)
const
->
void
{
DeleteSingleRoleRequest
request
;
request
.
set_name
(
name
);
DeleteSingleRoleResponse
response
;
...
...
@@ -211,7 +211,7 @@ auto Connection::CreateSingleRole(const Role &role) const -> void {
// TODO(tf) find a way to deal with this:
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
[[
nodiscard
]]
auto
Connection
::
RetrieveSingleUser
(
std
::
string
realm
,
std
::
string
name
)
const
[[
nodiscard
]]
auto
Connection
::
RetrieveSingleUser
(
const
std
::
string
&
realm
,
const
std
::
string
&
name
)
const
->
User
{
RetrieveSingleUserRequest
request
;
request
.
set_name
(
name
);
...
...
@@ -243,7 +243,7 @@ auto Connection::CreateSingleRole(const Role &role) const -> void {
// TODO(tf) find a way to deal with this:
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
auto
Connection
::
DeleteSingleUser
(
std
::
string
realm
,
std
::
string
name
)
const
->
void
{
auto
Connection
::
DeleteSingleUser
(
const
std
::
string
&
realm
,
const
std
::
string
&
name
)
const
->
void
{
DeleteSingleUserRequest
request
;
request
.
set_name
(
name
);
request
.
set_realm
(
realm
);
...
...
This diff is collapsed.
Click to expand it.
src/cxxcaosdbcli.cpp
+
19
−
16
View file @
a5b7293b
...
...
@@ -21,6 +21,9 @@
*/
// A simple caosdb client
#ifdef BUILD_ACM
#include
"caosdb/acm/role.h"
// for Role
#endif
#include
"caosdb/connection.h"
// for Connection, ConnectionManager
#include
"caosdb/constants.h"
// for LIBCAOSDB_VERSION_MINOR, LIBCAOSDB_V...
#include
"caosdb/entity.h"
// for Entity
...
...
@@ -34,6 +37,8 @@
#include
<iostream>
// for operator<<, basic_ostream, basic_ost...
#include
<memory>
// for unique_ptr, allocator, __shared_ptr_...
#include
<string>
// for operator<<, char_traits
#include
<vector>
// for vector
const
auto
logger_name
=
"libcaosdb"
;
...
...
@@ -41,8 +46,6 @@ using boost::program_options::bool_switch;
using
boost
::
program_options
::
command_line_parser
;
using
boost
::
program_options
::
notify
;
using
boost
::
program_options
::
options_description
;
using
boost
::
program_options
::
parse_command_line
;
using
boost
::
program_options
::
positional_options_description
;
using
boost
::
program_options
::
store
;
using
boost
::
program_options
::
value
;
using
boost
::
program_options
::
variables_map
;
...
...
@@ -70,7 +73,7 @@ auto test_connection() -> void {
<<
std
::
endl
;
}
auto
retrieve_entity_by_id
(
std
::
string
id
)
->
void
{
auto
retrieve_entity_by_id
(
const
std
::
string
&
id
)
->
void
{
std
::
cout
<<
"Retrieve entity "
<<
id
<<
std
::
endl
;
const
auto
&
connection
=
caosdb
::
connection
::
ConnectionManager
::
GetDefaultConnection
();
auto
transaction
(
connection
->
CreateTransaction
());
...
...
@@ -85,7 +88,7 @@ auto retrieve_entity_by_id(std::string id) -> void {
}
}
auto
execute_query
(
std
::
string
query
)
->
void
{
auto
execute_query
(
const
std
::
string
&
query
)
->
void
{
std
::
cout
<<
"Execute query:
\n
"
<<
query
<<
std
::
endl
;
const
auto
&
connection
=
caosdb
::
connection
::
ConnectionManager
::
GetDefaultConnection
();
auto
q_transaction
(
connection
->
CreateTransaction
());
...
...
@@ -105,25 +108,25 @@ auto list_roles() -> void {
std
::
cout
<<
"Known roles:"
<<
std
::
endl
;
const
auto
&
connection
=
caosdb
::
connection
::
ConnectionManager
::
GetDefaultConnection
();
auto
roles
=
connection
->
ListRoles
();
for
(
const
auto
role
:
roles
)
{
for
(
const
auto
&
role
:
roles
)
{
std
::
cout
<<
role
.
ToString
()
<<
std
::
endl
;
}
}
auto
retrieve_role
(
std
::
string
name
)
{
auto
retrieve_role
(
const
std
::
string
&
name
)
{
const
auto
&
connection
=
caosdb
::
connection
::
ConnectionManager
::
GetDefaultConnection
();
auto
role
=
connection
->
RetrieveSingleRole
(
name
);
std
::
cout
<<
role
.
ToString
()
<<
std
::
endl
;
}
auto
create_role
(
std
::
string
name
)
{
auto
create_role
(
const
std
::
string
&
name
)
{
const
auto
&
connection
=
caosdb
::
connection
::
ConnectionManager
::
GetDefaultConnection
();
Role
role
(
name
);
connection
->
CreateSingleRole
(
rol
e
);
connection
->
CreateSingleRole
(
nam
e
);
std
::
cout
<<
"OK"
<<
std
::
endl
;
}
auto
delete_role
(
std
::
string
name
)
{
auto
delete_role
(
const
std
::
string
&
name
)
{
const
auto
&
connection
=
caosdb
::
connection
::
ConnectionManager
::
GetDefaultConnection
();
connection
->
DeleteSingleRole
(
name
);
std
::
cout
<<
"OK"
<<
std
::
endl
;
...
...
@@ -164,16 +167,16 @@ auto main(int argc, const char *argv[]) -> int {
if
(
vm
.
count
(
"help"
))
{
std
::
cout
<<
desc
<<
std
::
endl
;
}
else
if
(
vm
[
"version"
].
as
<
bool
>
())
{
}
else
if
(
vm
.
count
(
"test-connection"
))
{
}
else
if
(
vm
.
count
(
"test-connection"
)
!=
0U
)
{
test_connection
();
#ifdef BUILD_ACM
}
else
if
(
vm
.
count
(
"list-roles"
))
{
}
else
if
(
vm
.
count
(
"list-roles"
)
!=
0U
)
{
list_roles
();
}
else
if
(
vm
.
count
(
"retrieve-role"
))
{
}
else
if
(
vm
.
count
(
"retrieve"
))
{
}
else
if
(
vm
.
count
(
"create-role"
))
{
}
else
if
(
vm
.
count
(
"delete-role"
))
{
}
else
if
(
vm
.
count
(
"execute-query"
))
{
}
else
if
(
vm
.
count
(
"retrieve-role"
)
!=
0U
)
{
}
else
if
(
vm
.
count
(
"retrieve"
))
!=
0U
{
}
else
if
(
vm
.
count
(
"create-role"
)
!=
0U
)
{
}
else
if
(
vm
.
count
(
"delete-role"
)
!=
0U
)
{
}
else
if
(
vm
.
count
(
"execute-query"
)
!=
0U
)
{
#endif
}
else
{
print_version
(
true
);
...
...
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