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
07b15011
Commit
07b15011
authored
4 months ago
by
Joscha Schmiedt
Browse files
Options
Downloads
Plain Diff
Merge branch 'f-better-errors' into 'dev'
F better errors See merge request
!59
parents
a2691ff3
92169ec2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!61
Release 0.3.0
,
!59
F better errors
Pipeline
#57536
passed with warnings
4 months ago
Stage: info
Stage: setup
Stage: test
Stage: deploy
Pipeline: caosdb-cppinttest
#57545
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
conanfile.py
+8
-3
8 additions, 3 deletions
conanfile.py
src/cxxlinkaheadcli.cpp
+18
-11
18 additions, 11 deletions
src/cxxlinkaheadcli.cpp
src/linkahead/utility.cpp
+4
-0
4 additions, 0 deletions
src/linkahead/utility.cpp
with
30 additions
and
14 deletions
conanfile.py
+
8
−
3
View file @
07b15011
...
...
@@ -37,9 +37,14 @@ class LinkAheadConan(ConanFile):
self
.
tool_requires
(
"
cmake/[>=3.13]
"
)
self
.
tool_requires
(
"
boost/1.80.0
"
)
self
.
test_requires
(
"
gtest/1.11.0
"
)
self
.
requires
(
"
grpc/1.48.4
"
)
self
.
requires
(
"
protobuf/3.21.12
"
)
self
.
requires
(
"
boost/1.80.0
"
)
def
requirements
(
self
):
self
.
requires
(
"
grpc/1.48.4
"
,
transitive_headers
=
True
,
transitive_libs
=
True
)
self
.
requires
(
"
protobuf/3.21.12
"
,
transitive_headers
=
True
,
transitive_libs
=
True
)
self
.
requires
(
"
boost/1.80.0
"
,
transitive_headers
=
True
,
transitive_libs
=
True
)
def
test_requirements
(
self
):
self
.
test_requires
(
"
gtest/1.11.0
"
)
def
config_options
(
self
):
if
self
.
settings
.
os
==
"
Windows
"
:
...
...
This diff is collapsed.
Click to expand it.
src/cxxlinkaheadcli.cpp
+
18
−
11
View file @
07b15011
...
...
@@ -43,20 +43,27 @@ const auto logger_name = "liblinkahead";
auto
main
()
->
int
{
std
::
cout
<<
"LinkAhead C++ client (liblinkahead "
<<
linkahead
::
LIBLINKAHEAD_VERSION_M
IN
OR
<<
"."
std
::
cout
<<
"LinkAhead C++ client (liblinkahead "
<<
linkahead
::
LIBLINKAHEAD_VERSION_M
AJ
OR
<<
"."
<<
linkahead
::
LIBLINKAHEAD_VERSION_MINOR
<<
"."
<<
linkahead
::
LIBLINKAHEAD_VERSION_PATCH
<<
")
\n
"
<<
std
::
endl
;
<<
")
\n
"
;
try
{
const
auto
&
connection
=
linkahead
::
connection
::
ConnectionManager
::
GetDefaultConnection
();
connection
->
RetrieveVersionInfoNoExceptions
();
auto
status
=
connection
->
RetrieveVersionInfoNoExceptions
();
if
(
status
.
GetCode
()
==
linkahead
::
CONNECTION_ERROR
)
{
const
auto
connection_config
=
linkahead
::
configuration
::
ConfigurationManager
::
GetDefaultConnectionConfiguration
();
std
::
cout
<<
"ConnectionError: Cannot connect to "
<<
connection_config
->
GetHost
()
<<
":"
<<
connection_config
->
GetPort
()
<<
'\n'
;
return
1
;
}
// get version info of the server
const
auto
&
v_info
=
connection
->
GetVersionInfo
();
std
::
cout
<<
"Server Version: "
<<
v_info
->
GetMajor
()
<<
"."
<<
v_info
->
GetMinor
()
<<
"."
<<
v_info
->
GetPatch
()
<<
"-"
<<
v_info
->
GetPreRelease
()
<<
"-"
<<
v_info
->
GetBuild
()
<<
std
::
endl
;
<<
'\n'
;
// retrieve an entity
auto
transaction
(
connection
->
CreateTransaction
());
...
...
@@ -67,12 +74,12 @@ auto main() -> int {
<<
"status: "
<<
t_stat
.
GetCode
()
<<
" // "
<<
t_stat
.
GetDescription
();
const
auto
&
result_set
=
transaction
->
GetResultSet
();
for
(
const
auto
&
entity
:
result_set
)
{
std
::
cout
<<
entity
.
ToString
()
<<
std
::
endl
;
std
::
cout
<<
entity
.
ToString
()
<<
'\n'
;
}
// execute a query
std
::
string
query
(
"FIND Property
\"
Prop *
\"
"
);
std
::
cout
<<
"Trying to execute a query:
\n
"
<<
query
<<
std
::
endl
;
std
::
cout
<<
"Trying to execute a query:
\n
"
<<
query
<<
'\n'
;
auto
q_transaction
(
connection
->
CreateTransaction
());
q_transaction
->
Query
(
query
);
q_transaction
->
ExecuteAsynchronously
();
...
...
@@ -81,18 +88,18 @@ auto main() -> int {
<<
"status: "
<<
t_stat
.
GetCode
()
<<
" // "
<<
t_stat
.
GetDescription
();
const
auto
&
result_set_2
=
q_transaction
->
GetResultSet
();
for
(
const
auto
&
entity
:
result_set_2
)
{
std
::
cout
<<
entity
.
ToString
()
<<
std
::
endl
;
std
::
cout
<<
entity
.
ToString
()
<<
'\n'
;
}
return
0
;
}
catch
(
const
linkahead
::
exceptions
::
ConfigurationError
&
exc
)
{
std
::
cout
<<
"ConfigurationError: "
<<
exc
.
what
()
<<
std
::
endl
;
std
::
cout
<<
"ConfigurationError: "
<<
exc
.
what
()
<<
'\n'
;
return
exc
.
GetCode
();
}
catch
(
const
std
::
exception
&
exc
)
{
std
::
cout
<<
"Exception: "
<<
exc
.
what
()
<<
std
::
endl
;
std
::
cout
<<
"Exception: "
<<
exc
.
what
()
<<
'\n'
;
return
1
;
}
catch
(...)
{
std
::
cout
<<
"Some other exception."
<<
std
::
endl
;
std
::
cout
<<
"Some other exception."
<<
'\n'
;
return
2
;
}
}
This diff is collapsed.
Click to expand it.
src/linkahead/utility.cpp
+
4
−
0
View file @
07b15011
...
...
@@ -108,6 +108,10 @@ template <> auto getEnumValueFromName<Role>(const std::string &name) -> Role {
auto
load_string_file
(
const
path
&
file_path
)
->
std
::
string
{
std
::
string
result
;
if
(
!
exists
(
file_path
))
{
throw
std
::
runtime_error
(
"File not found: "
+
file_path
.
string
());
}
// adapted from boost::filesystem::load_string_file, which was removed in 1.84
std
::
ifstream
file
;
file
.
exceptions
(
std
::
ios_base
::
failbit
|
std
::
ios_base
::
badbit
);
...
...
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