pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <joe.conway@mail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: libpq/c function question
Date: Sat, 27 Jan 2001 20:08:31 -0800
Message-ID: <01ef01c088df$fa17eb50$0705a8c0@jecw2k1> (raw)
References: <Pine.GSO.4.10.10101251120200.21455-100000@sun4.plasma.ernet.in>
	<01aa01c088d4$cae4f220$0705a8c0@jecw2k1>
	<29142.980653714@sss.pgh.pa.us>

> "Joe Conway" <joe.conway@mail.com> writes:
> > optstr = PG_GETARG_TEXT_P(0);
> > jpgsql = PG_GETARG_TEXT_P(1);
> 
> > conn = PQconnectdb(VARDATA(optstr));
> 
> I think you've missed the fact that a TEXT value's VARDATA is not
> null-terminated.  There are numerous examples of transforming a TEXT
> into a C string in the backend, see for example text_cmp/varstr_cmp
> in src/backend/utils/adt/varlena.c.
> 
> regards, tom lane

That did the trick!

Thank you!!

Joe









view thread (3+ messages)

Message-ID: <01ef01c088df$fa17eb50$0705a8c0@jecw2k1>
Permalink:  ../01ef01c088df$fa17eb50$0705a8c0@jecw2k1/
Also on:    postgresql.org/message-id/01ef01c088df$fa17eb50$0705a8c0@jecw2k1

 · 

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: pgsql-interfaces@postgresql.org
  Cc: joe.conway@mail.com, tgl@sss.pgh.pa.us
  Subject: Re: libpq/c function question
  In-Reply-To: <01ef01c088df$fa17eb50$0705a8c0@jecw2k1>

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

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