Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander.A,Utkin committed Dec 5, 2024
1 parent fda67a0 commit ed49111
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
4 changes: 1 addition & 3 deletions pyreindexer/lib/include/queryresults_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ class QueryResultsWrapper {

void FetchResults() {
assert(wrap_);
// when results are fetched iterator closes and frees a memory of results buffer of Reindexer
++it_;
if (it_ == qres_.end()) {
it_ = qres_.begin();
}
}

const std::vector<reindexer::AggregationResult>& GetAggregationResults() & { return qres_.GetAggregationResults(); }
Expand Down
12 changes: 4 additions & 8 deletions pyreindexer/lib/src/rawpyreindexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ static PyObject* itemModify(PyObject* self, PyObject* args, ItemModifyMode mode)

Py_DECREF(itemDefDict);

char* json = const_cast<char*>(wrSer.c_str());
err = item.Unsafe().FromJSON(json, 0, mode == ModeDelete);
err = item.Unsafe().FromJSON(wrSer.c_str(), 0, mode == ModeDelete);
if (!err.ok()) {
Py_XDECREF(preceptsList);

Expand All @@ -246,7 +245,7 @@ static PyObject* itemModify(PyObject* self, PyObject* args, ItemModifyMode mode)
return pyErr(err);
}

item.SetPrecepts(itemPrecepts);
item.SetPrecepts(itemPrecepts); // ToDo after migrate on v.4, do std::move
}

Py_XDECREF(preceptsList);
Expand Down Expand Up @@ -515,8 +514,7 @@ static PyObject* itemModifyTransaction(PyObject* self, PyObject* args, ItemModif

Py_DECREF(itemDefDict);

char* json = const_cast<char*>(wrSer.c_str());
err = item.Unsafe().FromJSON(json, 0, mode == ModeDelete);
err = item.Unsafe().FromJSON(wrSer.c_str(), 0, mode == ModeDelete);
if (!err.ok()) {
Py_XDECREF(preceptsList);

Expand All @@ -534,7 +532,7 @@ static PyObject* itemModifyTransaction(PyObject* self, PyObject* args, ItemModif
return pyErr(err);
}

item.SetPrecepts(itemPrecepts);
item.SetPrecepts(itemPrecepts); // ToDo after migrate on v.4, do std::move
}

Py_XDECREF(preceptsList);
Expand Down Expand Up @@ -566,7 +564,6 @@ static PyObject* CommitTransaction(PyObject* self, PyObject* args) {

auto transaction = getWrapper<TransactionWrapper>(transactionWrapperAddr);

assert((StopTransactionMode::Commit == stopMode) || (StopTransactionMode::Rollback == stopMode));
size_t count = 0;
Error err = transaction->Commit(count);

Expand All @@ -583,7 +580,6 @@ static PyObject* RollbackTransaction(PyObject* self, PyObject* args) {

auto transaction = getWrapper<TransactionWrapper>(transactionWrapperAddr);

assert((StopTransactionMode::Commit == stopMode) || (StopTransactionMode::Rollback == stopMode));
Error err = transaction->Rollback();

wrapperDelete<TransactionWrapper>(transactionWrapperAddr);
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def build_cmake(self, ext):


setup(name=PACKAGE_NAME,
version='0.2.44',
version='0.2.45',
description='A connector that allows to interact with Reindexer',
author='Igor Tulmentyev',
author_email='[email protected]',
Expand Down

0 comments on commit ed49111

Please sign in to comment.