Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Re: more custom...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 4 Topic 15463 of 17437
Post > Topic >>

Re: more custom C function fun

by kleptog@[EMAIL PROTECTED] (Martijn van Oosterhout) May 6, 2008 at 05:59 PM

--S5HS5MvDw4DmbRmb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, May 06, 2008 at 09:39:50AM -0600, Dan Heron Myers wrote:
> Using DatumToCString(mytextvariable), I get single-character-length=20
> 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=
=20
> obscured) (using strlen to get the string's length):

Not null terminated.

> Which is what I need.  Perhaps we could get some do***entation about
how=
=20
> to use this stuff?  I was unable to find any on the Postgres site, if=20
> 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,
--=20
Martijn van Oosterhout   <kleptog@[EMAIL PROTECTED]
>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while=20
> boarding. Thank you for flying nlogn airlines.

--S5HS5MvDw4DmbRmb
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIIIBwIB7bNG8LQkwRApBRAJ4ylBQVcb6priTuEiFwg9R10DwjmQCePyBu
N3b40eh9c0UfoMR1C1aQF5g=
=w0ew
-----END PGP SIGNATURE-----

--S5HS5MvDw4DmbRmb--
 




 4 Posts in Topic:
more custom C function fun
heron@[EMAIL PROTECTED]   2008-05-05 23:43:40 
Re: more custom C function fun
kleptog@[EMAIL PROTECTED]  2008-05-06 08:48:26 
Re: more custom C function fun
heron@[EMAIL PROTECTED]   2008-05-06 09:39:50 
Re: more custom C function fun
kleptog@[EMAIL PROTECTED]  2008-05-06 17:59:44 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 12:21:44 CST 2008.