Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-julialib
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-julialib
Commits
b5209375
Commit
b5209375
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Print version info in a nice way
parent
fec47721
No related branches found
No related tags found
2 merge requests
!3
TST: Add CI infrastructure for integration testing
,
!2
ENH: Add minimal wrapping of libcaosdb's C interface
Pipeline
#10278
passed
3 years ago
Stage: code-style
Stage: setup
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/CaosDB.jl
+27
-4
27 additions, 4 deletions
src/CaosDB.jl
with
27 additions
and
4 deletions
src/CaosDB.jl
+
27
−
4
View file @
b5209375
...
...
@@ -270,9 +270,8 @@ to.
"""
function
get_version_info
(
con
::
Ref
{
CaosDBConnection
})
println
(
"Entering get_version_info..."
)
info
=
Ref
{
CaosDB
.
Info
.
VersionInfo
}(
CaosDB
.
Info
.
VersionInfo
())
println
(
"Calling c function"
)
err_code
=
ccall
(
(
:
caosdb_connection_get_version_info
,
"libccaosdb"
),
Cint
,
...
...
@@ -280,7 +279,7 @@ function get_version_info(con::Ref{CaosDBConnection})
info
,
con
,
)
println
(
"Return code
$
err_code"
)
# TODO Real error-code handling
if
err_code
!=
0
...
...
@@ -292,6 +291,29 @@ function get_version_info(con::Ref{CaosDBConnection})
end
"""
print_version_info(con::Ref{CaosDBConnection})
Retrieve the version info for the CaosDB server `con` is connected to,
and print the version in a nice message.
"""
function
print_version_info
(
con
::
Ref
{
CaosDBConnection
})
# Dereference to access the fields
info
=
get_version_info
(
con
)[]
major
=
info
.
major
minor
=
info
.
minor
patch
=
info
.
patch
pre_release_str
=
unsafe_string
(
info
.
pre_release
)
build_str
=
unsafe_string
(
info
.
build
)
println
(
"Connected to a CaosDB server with version
$
major.
$
minor.
$
patch-
$
pre_release_str-
$
build_str."
,
)
end
function
connect
(
host
::
AbstractString
=
nothing
,
port_str
::
AbstractString
=
nothing
,
...
...
@@ -308,7 +330,7 @@ function connect(
if
port_str
==
nothing
port
=
CaosDB
.
Utility
.
get_env_var
(
"CAOSDB_SERVER_GRPC_PORT_HTTPS"
,
"
localhost
"
)
port
=
CaosDB
.
Utility
.
get_env_var
(
"CAOSDB_SERVER_GRPC_PORT_HTTPS"
,
"
8443
"
)
end
...
...
@@ -337,6 +359,7 @@ function connect(
CaosDB
.
Authentication
.
create_plain_password_authenticator
(
username
,
password
)
config
=
create_tls_connection_configuration
(
host
,
port
,
authenticator
,
provider
)
connection
=
create_connection
(
config
)
print_version_info
(
connection
)
return
connection
...
...
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