From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Lonnie Cumberland <lonnie_cumberland(at)yahoo(dot)com> |
Cc: | <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | Re: Now for the VARDATA, VARSIZE, and VARHDRSZ stuff |
Date: | 2001-04-16 14:03:54 |
Message-ID: | Pine.LNX.4.30.0104161558510.760-100000@peter.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces pgsql-sql |
Lonnie Cumberland writes:
> I now have a simple question about the use of these VARDATA() VARSIZE() and
> VARHDRSZ() wrappers
VARDATA is a pointer (to char?) to where the actual data of the specific
value starts. VARSIZE is the length of the specific value, plus the
header. VARHRDZ is the size of the header, currently always 4. For
example, if you have a text string 'abc' then the memory representation is
int 4 <-- text* points here
char 'a' <-- VARDATA points here
char 'b'
char 'c'
VARHDRZ == 4, VARSIZE = 7
Note that the data is not null-terminated.
The best things might be not to mess with this but call textin() and
textout() to convert your data to C strings.
--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter
From | Date | Subject | |
---|---|---|---|
Next Message | Achim Gottinger | 2001-04-16 19:05:13 | perl install problem with pg7.1 |
Previous Message | Lonnie Cumberland | 2001-04-16 12:21:17 | making data types |
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Hoffmann | 2001-04-16 14:18:32 | Re: RTREE on points |
Previous Message | Bernardo de Barros Franco | 2001-04-16 13:59:57 | Re: Using Random Sequence as Key |