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
14731539
Commit
14731539
authored
Aug 24, 2021
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
STY: Style changes and docstrings.
parent
79af0a93
No related branches found
No related tags found
1 merge request
!15
ENH: Allow insert/update/delete and files in Extern C
Pipeline
#12477
failed
Aug 24, 2021
Stage: info
Stage: setup
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/ccaosdb.h
+7
-5
7 additions, 5 deletions
include/ccaosdb.h
src/ccaosdb.cpp
+9
-9
9 additions, 9 deletions
src/ccaosdb.cpp
test/test_ccaosdb.cpp
+1
-1
1 addition, 1 deletion
test/test_ccaosdb.cpp
with
17 additions
and
15 deletions
include/ccaosdb.h
+
7
−
5
View file @
14731539
...
...
@@ -279,10 +279,12 @@ int caosdb_connection_connection_create_transaction(caosdb_connection_connection
int
caosdb_transaction_delete_transaction
(
caosdb_transaction_transaction
*
transaction
);
int
caosdb_transaction_transaction_retrieve_by_id
(
caosdb_transaction_transaction
*
transaction
,
const
char
*
id
);
int
caosdb_transaction_transaction_retrieve_and_download_file_by_id
(
caosdb_transaction_transaction
*
transaction
,
int
caosdb_transaction_transaction_retrieve_and_download_file_by_id
(
caosdb_transaction_transaction
*
transaction
,
const
char
*
id
,
const
char
*
path
);
int
caosdb_transaction_transaction_retrieve_by_ids
(
caosdb_transaction_transaction
*
transaction
,
int
caosdb_transaction_transaction_retrieve_by_ids
(
caosdb_transaction_transaction
*
transaction
,
const
char
*
ids
[],
int
length
);
int
caosdb_transaction_transaction_query
(
caosdb_transaction_transaction
*
transaction
,
const
char
*
query
);
...
...
This diff is collapsed.
Click to expand it.
src/ccaosdb.cpp
+
9
−
9
View file @
14731539
...
...
@@ -75,7 +75,7 @@ extern "C" {
GENERIC_ERROR, \
int caosdb_entity_entity_get_##element(caosdb_entity_entity *entity, char **out), { \
auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); \
char
*tmp = (char *)malloc(sizeof(char) * wrapped_entity->GetFunction.length() + 1); \
auto
*tmp = (char *)malloc(sizeof(char) * wrapped_entity->GetFunction.length() + 1); \
strcpy(tmp, wrapped_entity->GetFunction.c_str()); \
delete[] * out; \
*out = tmp; \
...
...
@@ -101,7 +101,7 @@ extern "C" {
GENERIC_ERROR, \
int caosdb_entity_property_get_##element(caosdb_entity_property *property, char **out), { \
auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); \
char
*tmp = (char *)malloc(sizeof(char) * wrapped_property->GetFunction.length() + 1); \
auto
*tmp = (char *)malloc(sizeof(char) * wrapped_property->GetFunction.length() + 1); \
strcpy(tmp, wrapped_property->GetFunction.c_str()); \
delete[] * out; \
*out = tmp; \
...
...
@@ -128,7 +128,7 @@ extern "C" {
GENERIC_ERROR, \
int caosdb_entity_parent_get_##element(caosdb_entity_parent *parent, char **out), { \
auto *wrapped_parent = WRAPPED_PARENT_CAST(parent); \
char
*tmp = (char *)malloc(sizeof(char) * wrapped_parent->GetFunction.length() + 1); \
auto
*tmp = (char *)malloc(sizeof(char) * wrapped_parent->GetFunction.length() + 1); \
strcpy(tmp, wrapped_parent->GetFunction.c_str()); \
delete[] * out; \
*out = tmp; \
...
...
@@ -338,12 +338,12 @@ ERROR_RETURN_CODE(
out
->
patch
=
(
int
)
version_info
->
GetPatch
();
// copy pre_release, needs local variable because out->pre_release is const
char
*
pre_release
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
(
version_info
->
GetPreRelease
().
length
()
+
1
));
auto
*
pre_release
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
(
version_info
->
GetPreRelease
().
length
()
+
1
));
strcpy
(
pre_release
,
version_info
->
GetPreRelease
().
c_str
());
out
->
pre_release
=
pre_release
;
// copy build, needs local variable because out->build is const
char
*
build
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
(
version_info
->
GetBuild
().
length
()
+
1
));
auto
*
build
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
(
version_info
->
GetBuild
().
length
()
+
1
));
strcpy
(
build
,
version_info
->
GetBuild
().
c_str
());
out
->
build
=
build
;
...
...
@@ -588,7 +588,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR,
int
caosdb_entity_entity_get_role
(
caosdb_entity_entity
*
entity
,
char
**
out
),
{
auto
*
wrapped_entity
=
WRAPPED_ENTITY_CAST
(
entity
);
std
::
string
role_str
=
ENUM_NAME_FROM_VALUE
(
wrapped_entity
->
GetRole
(),
Role
);
char
*
tmp
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
role_str
.
length
()
+
1
);
auto
*
tmp
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
role_str
.
length
()
+
1
);
strcpy
(
tmp
,
role_str
.
c_str
());
delete
[]
*
out
;
*
out
=
tmp
;
...
...
@@ -600,7 +600,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR,
{
auto
*
wrapped_entity
=
WRAPPED_ENTITY_CAST
(
entity
);
auto
path
=
wrapped_entity
->
GetLocalPath
().
string
();
char
*
tmp
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
path
.
length
()
+
1
);
auto
*
tmp
=
(
char
*
)
(
malloc
(
sizeof
(
char
)
*
path
.
length
()
+
1
)
)
;
strcpy
(
tmp
,
path
.
c_str
());
delete
[]
*
out
;
*
out
=
tmp
;
...
...
@@ -951,7 +951,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR,
{
auto
*
wrapped_property
=
WRAPPED_PROPERTY_CAST
(
property
);
auto
value_list
=
wrapped_property
->
GetValue
().
AsList
();
char
*
tmp
=
auto
*
tmp
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
value_list
[
index
].
AsString
().
length
()
+
1
);
strcpy
(
tmp
,
value_list
[
index
].
AsString
().
c_str
());
delete
[]
*
out
;
...
...
@@ -984,7 +984,7 @@ ERROR_RETURN_CODE(
GENERIC_ERROR
,
int
caosdb_entity_message_get_description
(
caosdb_entity_message
*
message
,
char
**
out
),
{
auto
*
wrapped_message
=
static_cast
<
caosdb
::
entity
::
Message
*>
(
message
->
wrapped_message
);
char
*
tmp
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
wrapped_message
->
GetDescription
().
length
()
+
1
);
auto
*
tmp
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
wrapped_message
->
GetDescription
().
length
()
+
1
);
strcpy
(
tmp
,
wrapped_message
->
GetDescription
().
c_str
());
delete
[]
*
out
;
*
out
=
tmp
;
...
...
This diff is collapsed.
Click to expand it.
test/test_ccaosdb.cpp
+
1
−
1
View file @
14731539
...
...
@@ -465,7 +465,7 @@ TEST_F(test_ccaosdb, test_remove_property) {
}
TEST_F
(
test_ccaosdb
,
test_insert_update_delete
)
{
// Only test adding to a transaction
, e
xcution and results are
// Only test adding to a transaction
. E
xcution and results are
// tested in integration tests.
caosdb_connection_connection
connection
;
caosdb_connection_connection_manager_get_default_connection
(
&
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