diff --git a/libstuff/SQResult.cpp b/libstuff/SQResult.cpp index 7a9d3e9f3..2eb447296 100644 --- a/libstuff/SQResult.cpp +++ b/libstuff/SQResult.cpp @@ -162,3 +162,12 @@ const SQResultRow& SQResult::operator[](size_t rowNum) const { STHROW("Out of range"); } } + +SQResult& SQResult::operator=(const SQResult& other) { + headers = other.headers; + rows = other.rows; + for (auto& row : rows) { + row.result = this; + } + return *this; +} diff --git a/libstuff/SQResult.h b/libstuff/SQResult.h index 001907fa9..1ecd3560f 100644 --- a/libstuff/SQResult.h +++ b/libstuff/SQResult.h @@ -6,6 +6,7 @@ using namespace std; class SQResult; class SQResultRow : public vector { + friend class SQResult; public: SQResultRow(); SQResultRow(SQResult& result, size_t count = 0); @@ -36,6 +37,7 @@ class SQResult { // Operators SQResultRow& operator[](size_t rowNum); const SQResultRow& operator[](size_t rowNum) const; + SQResult& operator=(const SQResult& other); // Serializers string serializeToJSON() const;