Re: libpq/c function question - Mailing list pgsql-interfaces

From Joe Conway
Subject Re: libpq/c function question
Date
Msg-id 01ef01c088df$fa17eb50$0705a8c0@jecw2k1
Whole thread Raw
In response to Re: [ANNOUNCE] Gedafe (the Generic Database Front-End) 1.0.0  (Manika Dey <bithi@ipr.res.in>)
List pgsql-interfaces
> "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








pgsql-interfaces by date:

Previous
From: Tom Lane
Date:
Subject: Re: libpq/c function question
Next
From: Jean-Francois Burdet
Date:
Subject: jdbc: v7.1 bug (letter accent)