Search Postgresql Archives

Re: more custom C function fun

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 06, 2008 at 09:39:50AM -0600, Dan Heron Myers wrote:
> Using DatumToCString(mytextvariable), I get single-character-length 
> strings that do not match the data actually in the fields.

Correct, because it's not a cstring. Pretending it is one gives you
garbage.

> Using VARDATA(mytextvariable) as the char*, I get things like this (name 
> obscured) (using strlen to get the string's length):

Not null terminated.

> Which is what I need.  Perhaps we could get some documentation about how 
> to use this stuff?  I was unable to find any on the Postgres site, if 
> there is any.

Well, here's an example of how you should do it:

http://www.postgresql.org/docs/8.2/interactive/spi-examples.html

Not the most obvious place. The best place is the source,
utils/adt/text contains lots of functions on text variables, so you can
see how they work.

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog@xxxxxxxxx>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while 
> boarding. Thank you for flying nlogn airlines.

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux