From b333d17308d935825a5da3c82276ff9f827dab18 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 13 Jun 2021 21:28:21 +0100 Subject: Add operator* to RecordSet, shorthand for getting scalar from 0,0 --- lib/dbRecordSet.cpp | 6 ++++++ lib/dbRecordSet.h | 1 + 2 files changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/dbRecordSet.cpp b/lib/dbRecordSet.cpp index 66ade0e..3754130 100644 --- a/lib/dbRecordSet.cpp +++ b/lib/dbRecordSet.cpp @@ -14,4 +14,10 @@ namespace MyGrate { { return {this, row}; } + + DbValue + RecordSet::operator*() const + { + return at(0, 0); + } } diff --git a/lib/dbRecordSet.h b/lib/dbRecordSet.h index c84bb46..e430e58 100644 --- a/lib/dbRecordSet.h +++ b/lib/dbRecordSet.h @@ -38,6 +38,7 @@ namespace MyGrate { virtual std::size_t columns() const = 0; virtual DbValue at(std::size_t, std::size_t) const = 0; RowView operator[](std::size_t row) const; + DbValue operator*() const; }; using RecordSetPtr = std::unique_ptr; } -- cgit v1.2.3