C++: headache with PgDatabase::GetValue (int, string)

From: "Carlos Moreno" <moreno(at)mochima(dot)com>
To: <pgsql-interfaces(at)postgresql(dot)org>
Subject: C++: headache with PgDatabase::GetValue (int, string)
Date: 2002-02-17 20:52:31
Message-ID: 200202171552.AA836829418@mochima.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces


Hi,

I wonder if this is an oversight in the design of the PgDatabase
class, or if I'm missing something, or doing something wrong.

Say I have two unrelated tables with fields witht the same name
(e.g., table Employees, with a field Name, and table Departments,
also with a field Name). I have a SELECT statement that returns
data from both tables, and I need both Name fields:

"select Emp.Name, Dept.Name from Emp, Dept where ....... "

Now, I (obviously) want to use GetValue (row, "field_name") to
get the values.

If I try GetValue (row, "Name") I'm in trouble (it won't know
which one -- and notice that it's not a case of an inner join,
where the Name will happen to be the same), and if I do
GetValue (row, "Emp.Name"), it returns NULL -- and the name
lookup logs an message to stderr.

Is there a workaround? (excluding of course the rather infamous
possibility of using GetValue(int,int) directly... I have already
enough trouble with my natural bugs to be asking for more trouble
:-))

Thanks!

Carlos
--

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter Eisentraut 2002-02-17 21:16:25 Re: C++: headache with PgDatabase::GetValue (int,
Previous Message Michael Meskes 2002-02-17 18:17:19 odbc on unix