agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: WEIX@puget.com
To: postgres@postgres.Berkeley.EDU
Subject: how to read array type?
Date: Sat, 13 May 1995 01:58 PDT
Message-ID: <9505130901.AA01234@mdd.comm.mot.com> (raw)

From:	NAME: Xinguo Wei                    
	FUNC:                                 
	TEL:                                  <WEIX AT A1 AT PTHWRK>
To:	smtp%postgres@nobozo.CS.Berkeley.EDU@mrgate


Hi everybody,

I defined a class which includes an array type:
      customer ( meter_reading = int4[],....);
The meter_reading will be populated by twelve monthly readings.

I also defined some functions on the customer class.  However, I am having some
troubles to read the meter_reading attribute by using the call 
GetAttributeByName().

I tried the following but it didn't work properly.

typedef int4 int_array[12];

float8 *get_demand_kwh(t)
TUPLE t;
{
       .....
       int_array *meter_reading;

       meter_reading = (int_array *) GetAttributeByName(t,meter_reading, 
                                                        &isnull);
       .....
}

I also tried to read individual element by the following statement and Postgres
complained about Attribute 'meter_reading[1:1]' not found.
      one_reading = (int4 *) GetAttributeByName(t,meter_reading[1:1],&isnull);

Any suggestions?

Xavier



==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU".
   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: WEIX@puget.com
  Subject: Re: how to read array type?
  In-Reply-To: <9505130901.AA01234@mdd.comm.mot.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox