Added to functions to Pgsql::Result to help in doing smart things based on a result.

- ftable, return from which table the column in the result originates
- ftableCol, returns the column number within that table (attnum)
Ofcourse columns can also be expressions in which case these functions return InvalidOid and 0.
This commit is contained in:
eelke 2018-11-10 11:36:35 +01:00
parent f629e48a85
commit cfc218c43b
2 changed files with 21 additions and 3 deletions

View file

@ -123,6 +123,15 @@ namespace Pgsql {
Oid type(int col) const;
bool null(int col, int row) const;
/// Return the oid of the table this is a column of
/// when the column isn't a table column InvalidOid is returned
/// when col is out of range a std::range_error is thrown
Oid ftable(int col) const;
/// Returns the attnum of col in its table, attnum is negative for system cols like oid
/// It is positive for user columns, 0 signals there is no direct table column mapping
/// when col is out of range a std::range_error is thrown
int ftableCol(int col) const;
// iterator begin();
private: