Files
MuditaOS/module-db/Database/QueryResult.cpp
Marek Niepieklo 7495d1b6e1 [CP-327] Fix UB in QueryResult
QueryResult iterator nextRow() may get into infinite loop.
Additionally, fixed handling of the case when each row of result
could have a different count of fields.
2021-07-12 16:50:04 +02:00

20 lines
387 B
C++

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "QueryResult.hpp"
QueryResult::QueryResult() : currentRow(0)
{}
void QueryResult::addRow(const std::vector<Field> &row)
{
rows.push_back(row);
}
bool QueryResult::nextRow()
{
++currentRow;
return (currentRow < rows.size());
}