Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CaosDB Octave library
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 Octave library
Commits
da1870e5
Verified
Commit
da1870e5
authored
3 years ago
by
Daniel Hornung
Browse files
Options
Downloads
Plain Diff
Merge branch 'f-final-review' into f-macos
parents
65c2233b
e767078c
No related branches found
No related tags found
2 merge requests
!6
Draft: ENH: Adapt for MacOS
,
!5
Final review
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
conanfile.txt
+3
-0
3 additions, 0 deletions
conanfile.txt
src/lib/maoxdb.cpp
+0
-1
0 additions, 1 deletion
src/lib/maoxdb.cpp
src/private/maox_transaction.cpp
+5
-35
5 additions, 35 deletions
src/private/maox_transaction.cpp
with
8 additions
and
36 deletions
conanfile.txt
+
3
−
0
View file @
da1870e5
[requires]
caosdb/[>=0.1.0]
[build_requires]
gtest/1.11.0
[generators]
cmake
This diff is collapsed.
Click to expand it.
src/lib/maoxdb.cpp
+
0
−
1
View file @
da1870e5
...
...
@@ -435,7 +435,6 @@ auto entitiesFromMx(const mxArray *array, bool for_update, string conn_name)
}
assignEntityDataFromMx
(
entity
,
array
,
index
);
entities
.
push_back
(
entity
);
// TODO (dh) Wtf, why can't I do entities[foo] = entity?
}
}
// insert only: No ID, only assign other values ///////////////////////////
...
...
This diff is collapsed.
Click to expand it.
src/private/maox_transaction.cpp
+
5
−
35
View file @
da1870e5
...
...
@@ -22,7 +22,7 @@
#include
"caosdb/constants.h"
// for LIBCAOSDB_VERSION_MAJOR, LIBCAOSDB_VE...
#include
"caosdb/exceptions.h"
// for all error handling
#include
"caosdb/info.h"
// for VersionInfo
//
#include "caosdb/logging.h" // for CAOSDB_LOG_TRACE
#include
"caosdb/logging.h"
// for CAOSDB_LOG_TRACE
#include
"caosdb/transaction_status.h"
// for TransactionStatus
#include
"maoxdb.hpp"
// caosDB utils for mex files
#include
"mex.h"
// for mxArray, mexFunction
...
...
@@ -36,19 +36,6 @@ using caosdb::connection::ConnectionManager;
using
caosdb
::
entity
::
Entity
;
using
std
::
string
;
// Workaround for issue caosdb-cpplib#17
#undef CAOSDB_LOG_TRACE
#undef CAOSDB_LOG_DEBUG
#undef CAOSDB_LOG_INFO
// #define CAOSDB_LOG_TRACE(name) std::clog << std::endl << "[" << name << "] "
// #define CAOSDB_LOG_DEBUG(name) std::clog << std::endl << "[" << name << "] "
// #define CAOSDB_LOG_INFO(name) std::clog << std::endl << "[" << name << "] "
std
::
ostream
nullout
(
nullptr
);
// NOLINT
#define CAOSDB_LOG_TRACE(name) nullout // NOLINT
#define CAOSDB_LOG_DEBUG(name) nullout // NOLINT
#define CAOSDB_LOG_INFO(name) nullout // NOLINT
const
auto
logger_name
=
"maox_transaction"
;
/**
...
...
@@ -131,31 +118,24 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
if
(
!
mxIsChar
(
prhs
[
0
]))
{
mexErrMsgIdAndTxt
(
"maox:InvalidArgument"
,
"The connection name must be a string."
);
}
CAOSDB_LOG_TRACE
(
logger_name
)
<<
"0"
<<
std
::
endl
;
conn_name
=
maoxdb
::
mxGetStdString
(
prhs
[
0
]);
CAOSDB_LOG_TRACE
(
logger_name
)
<<
"1"
<<
std
::
endl
;
retrieves
=
maoxdb
::
mxCellToStrings
(
prhs
[
1
]);
if
(
nrhs
>
2
)
{
CAOSDB_LOG_TRACE
(
logger_name
)
<<
"2"
<<
std
::
endl
;
queries
=
maoxdb
::
mxCellToStrings
(
prhs
[
2
]);
}
if
(
nrhs
>
3
)
{
CAOSDB_LOG_DEBUG
(
logger_name
)
<<
"3: insert"
<<
std
::
endl
;
inserts
=
maoxdb
::
entitiesFromMx
(
prhs
[
3
],
false
,
conn_name
);
}
if
(
nrhs
>
4
)
{
CAOSDB_LOG_TRACE
(
logger_name
)
<<
"4"
<<
std
::
endl
;
updates
=
maoxdb
::
entitiesFromMx
(
prhs
[
4
],
true
,
conn_name
);
}
if
(
nrhs
>
5
)
{
// NOLINT
CAOSDB_LOG_TRACE
(
logger_name
)
<<
"5"
<<
std
::
endl
;
deletes
=
maoxdb
::
mxCellToStrings
(
prhs
[
5
]);
// NOLINT
}
if
(
nrhs
==
7
)
{
// NOLINT
mexErrMsgIdAndTxt
(
"maox:InvalidArgument"
,
"File IDs need file download path arguments"
);
}
if
(
nrhs
>
7
)
{
// NOLINT
CAOSDB_LOG_TRACE
(
logger_name
)
<<
"6 & 7"
<<
std
::
endl
;
file_ids
=
maoxdb
::
mxCellToStrings
(
prhs
[
6
]);
// NOLINT
file_download_paths
=
maoxdb
::
mxCellToStrings
(
prhs
[
7
]);
// NOLINT
if
(
file_ids
.
size
()
!=
file_download_paths
.
size
())
{
...
...
@@ -175,7 +155,6 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
}
else
{
connection
=
ConnectionManager
::
GetConnection
(
conn_name
);
}
// CAOSDB_LOG_TRACE(logger_name) << "connection.use_count() " << connection.use_count();
auto
transaction
=
connection
->
CreateTransaction
();
// Fill transaction with content
std
::
for_each
(
retrieves
.
begin
(),
retrieves
.
end
(),
...
...
@@ -198,26 +177,17 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
if
(
transaction
->
IsStatus
(
caosdb
::
transaction
::
TransactionStatus
::
READY
())
||
transaction
->
IsStatus
(
caosdb
::
transaction
::
TransactionStatus
::
GO_ON
()))
{
const
auto
exec_stat
=
transaction
->
ExecuteAsynchronously
();
// NOLINT
// CAOSDB_LOG_TRACE(logger_name) << "Execute initiated, exec_stat: "
// << static_cast<int>(exec_stat)
// << " / "
// << caosdb::get_status_description(exec_stat);
if
(
exec_stat
!=
caosdb
::
StatusCode
::
EXECUTING
)
{
mexErrMsgIdAndTxt
(
"maox:Execution"
,
(
string
(
"Executing the transaction failed ("
)
+
std
::
to_string
(
static_cast
<
int
>
(
exec_stat
))
+
"): "
+
caosdb
::
get_status_description
(
exec_stat
))
.
c_str
());
}
const
auto
t_stat
=
transaction
->
WaitForIt
();
// CAOSDB_LOG_TRACE(logger_name) << "Waited";
// CAOSDB_LOG_DEBUG(logger_name) << "status: " << t_stat.GetCode() << " // "
// << t_stat.GetDescription();
maoxdb
::
throwOctExceptionIfError
(
transaction
.
get
());
// Status must be OK, INITIAL or GENERIC_TRANSACTION_ERROR now.
// CAOSDB_LOG_TRACE(logger_name) << "No Octave exception thrown.";
// std::cout << "status: " << transaction->GetStatus().GetCode() << " // "
// << transaction->GetStatus().GetDescription() << std::endl;
}
const
auto
t_stat
=
transaction
->
WaitForIt
();
maoxdb
::
throwOctExceptionIfError
(
transaction
.
get
());
// Status must be OK, INITIAL or GENERIC_TRANSACTION_ERROR now.
CAOSDB_LOG_ERROR
(
logger_name
)
<<
"CALL GetResultSet 1"
;
const
auto
&
results
=
transaction
->
GetResultSet
();
CAOSDB_LOG_TRACE
(
logger_name
)
<<
"ResultSet contents: "
;
CAOSDB_LOG_TRACE
(
logger_name
)
<<
"size: "
<<
results
.
size
();
...
...
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