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