Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces

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 




pgsql-interfaces by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group