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:
parent
f629e48a85
commit
cfc218c43b
2 changed files with 21 additions and 3 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue