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

Поиск
Список
Период
Сортировка
От Carlos Moreno
Тема C++: headache with PgDatabase::GetValue (int, string)
Дата
Msg-id 200202171552.AA836829418@mochima.com
обсуждение исходный текст
Ответы Re: C++: headache with PgDatabase::GetValue (int, string)  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: C++: headache with PgDatabase::GetValue (int,  (Peter Eisentraut <peter_e@gmx.net>)
Список 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
--



В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Michael Meskes
Дата:
Сообщение: odbc on unix
Следующее
От: Tom Lane
Дата:
Сообщение: Re: C++: headache with PgDatabase::GetValue (int, string)