agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
Can't use GetAttributeByName for text type..
2+ messages / 2 participants
[nested] [flat]

* Can't use GetAttributeByName for text type..
@ 1995-01-05 08:54  Xinguo Wei <wei@u.washington.edu>
  0 siblings, 1 reply; 2+ messages in thread

From: Xinguo Wei @ 1995-01-05 08:54 UTC (permalink / raw)
  To: legacy

Hi Postgresers,

I can't make the GetAttributeByName work for my text attribute.  The 
syntax I have is shown here,

char name[4];

strcpy(name,GetAttributeByName(t,"graphic_model", &isnull));

The attribute "graphic_model" is defined as text type.

The name array has all the garbage instead of the actual value.

What is the problem here?

My platform is Dec Alpha OSF/1.



Xinguo








==============================================================================
   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/



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Can't use GetAttributeByName for text type..
@ 1995-01-05 17:12  Paul M. Aoki <aoki@cs.berkeley.edu>
  parent: Xinguo Wei <wei@u.washington.edu>
  0 siblings, 0 replies; 2+ messages in thread

From: Paul M. Aoki @ 1995-01-05 17:12 UTC (permalink / raw)
  To: Xinguo Wei <wei@u.washington.edu>; +Cc: legacy

Xinguo Wei <wei@u.washington.edu> writes:
> char name[4];
> strcpy(name,GetAttributeByName(t,"graphic_model", &isnull));

"text" is not a C string.  "text" is

struct varlena {
        int32   vl_len;
        char    vl_dat[1];
};

[...]

typedef struct varlena text;

the data is not NUL-delimited.

(this is not particularly safe code in any case -- what happens if
graphic_model is null?)
--
  Paul M. Aoki          |  University of California at Berkeley
  aoki@CS.Berkeley.EDU  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776

==============================================================================
   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/



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1995-01-05 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1995-01-05 08:54 Can't use GetAttributeByName for text type.. Xinguo Wei <wei@u.washington.edu>
1995-01-05 17:12 ` Paul M. Aoki <aoki@cs.berkeley.edu>

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