diff --git a/pgsql/Pgsql_Result.cpp b/pgsql/Pgsql_Result.cpp index 1bcfa76..8ef7bcf 100644 --- a/pgsql/Pgsql_Result.cpp +++ b/pgsql/Pgsql_Result.cpp @@ -43,7 +43,6 @@ ErrorDetails ErrorDetails::createErrorDetailsFromPGresult(const PGresult *result return r; } - Result::Result(PGresult *res) : result(res) { @@ -96,7 +95,6 @@ std::string Result::diagSqlState() return s; } - ErrorDetails Result::diagDetails() { // ErrorDetails r; @@ -170,7 +168,6 @@ inline void Result::rowRangeCheck(int row) const throw std::range_error("row index out of range"); } - const char * Result::val(int col, int row) const { colRangeCheck(col); @@ -205,3 +202,15 @@ bool Result::null(int col, int row) const return PQgetisnull(result, row, col); } + +Oid Result::ftable(int col) const +{ + colRangeCheck(col); + return PQftable(result, col); +} + +int Result::ftableCol(int col) const +{ + colRangeCheck(col); + return PQftablecol(result, col); +} diff --git a/pgsql/Pgsql_Result.h b/pgsql/Pgsql_Result.h index 2f3c490..6945d91 100644 --- a/pgsql/Pgsql_Result.h +++ b/pgsql/Pgsql_Result.h @@ -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: