Abstract IResult interface for Result

This is to allow faking the result for testing the CrudModel.
This commit is contained in:
eelke 2022-02-06 12:19:43 +01:00
parent 06504ecc1f
commit c346430b25
6 changed files with 103 additions and 67 deletions

34
pgsql/Pgsql_IResult.h Normal file
View file

@ -0,0 +1,34 @@
#pragma once
#include "Pgsql_ResultConstIterator.h"
namespace Pgsql {
class IResult {
public:
virtual operator bool() const = 0;
virtual int tuplesAffected() const = 0;
virtual int rows() const = 0;
virtual int cols() const = 0;
virtual const char* getColName(int idx) const = 0;
virtual const char* val(int col, int row) const = 0;
virtual Value get(int col, int row) const = 0;
virtual Oid type(int col) const = 0;
virtual bool null(int col, int row) const = 0;
ResultConstIterator begin() const
{
return ResultConstIterator(*this, 0);
}
ResultConstIterator end() const
{
return ResultConstIterator(*this, rows());
}
};
}