Re: C++: headache with PgDatabase::GetValue (int, string)
От | Carlos Moreno |
---|---|
Тема | Re: C++: headache with PgDatabase::GetValue (int, string) |
Дата | |
Msg-id | 200202181104.AA4130865386@mochima.com обсуждение исходный текст |
Ответ на | C++: headache with PgDatabase::GetValue (int, string) ("Carlos Moreno" <moreno@mochima.com>) |
Список | 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 --
В списке pgsql-interfaces по дате отправления: