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

Re: Are multiple selects of the same field allowed

From: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
To: Kristis Makris <kristis(dot)makris(at)datasoft(dot)com>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Are multiple selects of the same field allowed
Date: 2002-02-20 04:52:25
Message-ID: 3C732B89.2FBBCEAA@tpf.co.jp (view raw or flat)
Thread:
Lists: pgsql-odbc
Kristis Makris wrote:
> 
> Hello,
> 
> I've recently begun using the v7.01.0010 ODBC driver Hiroshi made
> available. I'm issuing the following SQL statement:
> 
> "SELECT id, id FROM WaterResource"
> 
> Using VC++ I'm executing the following:
> 
> ++++++++++++++
> while (!rsNewRecords.IsEOF())
>         {
>                 rsNewRecords.GetFieldValue("id", vID, SQL_C_SLONG);
>                 rsNewRecords.GetFieldValue(strFieldName, strValue);
>                 [...]
> 
>                 rsNewRecords.MoveNext();
>         }
> ++++++++++++++
> 
> When execution hits the second .GetFieldValue() call with strFieldname
> being = "id" I get an exception, something that did not happen using the
> v7.01.0008 driver
> 
> As I understand, when .GetFieldName() is used once to retrieve the value
> of a field, a subsequent call to retrieve the exact same field fails.
> But in the case of selecting (and thus retrieving) a column twice,
> shouldn't two calls be possible/allowed for reading that field's value
> twice?

Hmm both field have the same field name "id" and the driver
couldn't distinguish them. Couldn't you change the query like
  "select id, id as id2 from WaterResourec"
?

regards,
Hiroshi Inoue

In response to

Responses

pgsql-odbc by date

Next:From: Jean-Michel POUREDate: 2002-02-20 07:35:29
Subject: Re: UTF-8 data migration problem in Postgresql 7.2
Previous:From: kuolung linDate: 2002-02-20 02:28:20
Subject: post

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