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

From: "Carlos Moreno" <moreno(at)mochima(dot)com>
To: <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: C++: headache with PgDatabase::GetValue (int, string)
Date: 2002-02-18 16:04:28
Message-ID: 200202181104.AA4130865386@mochima.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces


>> "select Emp.Name, Dept.Name from Emp, Dept where ....... "
>
>> Now, I (obviously) want to use GetValue (row, "field_name") to
>> get the values.
>
>If you "obviously" want to use a fetch-by-name operation to fetch
>fields, then it'd behoove you to name the columns differently in the
>first place. For example:
>
> select Emp.Name as emp_name, Dept.Name as dep_name from ...

A-ha!! The archi-known old trick of an alias for the column names!!
:-) (yeah, ok, so I'm watching too much "Get Smart" lately :-))

That also solves the second part of my problem (which I forgot to
mention when I wrote the message), which is when you select an
expression, such as "SELECT lower(name) .....".

I still was expecting the GetValue (row, "table.field") idiom to
work (I believe it works with the MySQL client API -- I know, I
know, who cares about that toy :-)), but this solution is good
anyway (I mean, it seems like a good idea to do it in the first
place), and it is universal, so I guess I'll stick to it.

Thanks Tom and Peter for your replies!

Carlos
--

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Meskes 2002-02-18 16:24:58 Re: odbc on unix
Previous Message Ebrahim Ahmed 2002-02-18 06:56:53 jdbc