Skip site navigation (1) Skip section navigation (2)

Re: libpq/c function question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joe Conway" <joe(dot)conway(at)mail(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: libpq/c function question
Date: 2001-01-28 03:48:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
"Joe Conway" <joe(dot)conway(at)mail(dot)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

In response to


pgsql-interfaces by date

Next:From: Joe ConwayDate: 2001-01-28 04:08:31
Subject: Re: libpq/c function question
Previous:From: Joe ConwayDate: 2001-01-28 02:48:28
Subject: libpq/c function question

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group