agora inbox for postgres@postgres.berkeley.edu
help / color / mirror / Atom feedFrom: Paul M. Aoki <aoki@postgres.Berkeley.EDU>
To: Patrick M. Landry <pml@cacs.usl.edu>
Cc: postgres@postgres.Berkeley.EDU
Subject: Re: PQpnames help
Date: Mon, 09 May 94 16:07:31 -0700
Message-ID: <199405092307.QAA29229@faerie.CS.Berkeley.EDU> (raw)
In-Reply-To: <199405091403.AA06404@console.cacs.usl.edu>
"Patrick M. Landry" <pml@cacs.usl.edu> writes:
> Could someone post a code fragment demostrating the use of PQpnames?
> I am trying to compile pgperl with postgres4.2. The regression tests
> don't seem to deal with PQpnames. Thanks
someone pointed out to us that you can't use the PQpnames that's there
without using portals_array_size, which is not the documented interface.
dooh. (it was extended to allow variable numbers of portals, since the
previous limit was just 10.) so this is the hack i came up with (it's
for src/backend/libpq/portal.c). i think it matches the documented
interface.
*** 1.18 1994/02/01 20:39:07
--- portal.c 1994/04/21 20:39:45
***************
*** 50,56 ****
* see utils/mmgr/portalmem.c for why. -cim 2/22/91
*
* IDENTIFICATION
! * $Header: /usr/local/devel/postgres/src/backend/libpq/RCS/portal.c,v 1.18 1994/02/01 20:39:07 jolly Exp $
* ----------------------------------------------------------------
*/
--- 50,56 ----
* see utils/mmgr/portalmem.c for why. -cim 2/22/91
*
* IDENTIFICATION
! * $Header: /usr/local/devel/postgres/src/backend/libpq/RCS/portal.c,v 1.19 1994/04/21 20:36:58 aoki Exp $
* ----------------------------------------------------------------
*/
***************
*** 61,67 ****
#include "tmp/libpq.h"
#include "utils/exc.h"
! RcsId("$Header: /usr/local/devel/postgres/src/backend/libpq/RCS/portal.c,v 1.18 1994/02/01 20:39:07 jolly Exp $");
/* ----------------
* exceptions
--- 61,67 ----
#include "tmp/libpq.h"
#include "utils/exc.h"
! RcsId("$Header: /usr/local/devel/postgres/src/backend/libpq/RCS/portal.c,v 1.19 1994/04/21 20:36:58 aoki Exp $");
/* ----------------
* exceptions
***************
*** 190,196 ****
--- 190,202 ----
/* --------------------------------
* PQpnames - Return all the portal names
* If rule_p, only return asynchronous portals.
+ *
* the caller must have allocated sufficient memory for char** pnames
+ * (an array of PQnportals strings of length PortalNameLength).
+ *
+ * notice that this assumes that the user is calling PQnportals and
+ * PQpnames with the same rule_p argument, and with no intervening
+ * portal closures. if not, you can get in heap big trouble..
* --------------------------------
*/
void
***************
*** 198,204 ****
char **pnames;
int rule_p;
{
! int i;
if (!valid_pointer("PQpnames: invalid name buffer", pnames))
return;
--- 204,210 ----
char **pnames;
int rule_p;
{
! int i, cur_pname = 0;
if (!valid_pointer("PQpnames: invalid name buffer", pnames))
return;
***************
*** 206,216 ****
for (i = 0; i < portals_array_size; ++i) {
if (portals[i] && portals[i]->portal) {
if (!rule_p || portals[i]->portal->rule_p) {
! (void) strncpy(pnames[i], portals[i]->name, PortalNameLength);
! continue;
}
}
- pnames[i][0] = '\0';
}
}
--- 212,221 ----
for (i = 0; i < portals_array_size; ++i) {
if (portals[i] && portals[i]->portal) {
if (!rule_p || portals[i]->portal->rule_p) {
! (void) strncpy(pnames[cur_pname], portals[i]->name, PortalNameLength);
! ++cur_pname;
}
}
}
}
--
Paul M. Aoki | CS Div., Dept. of EECS, UCB | aoki@postgres.Berkeley.EDU
| Berkeley, CA 94720 | ...!uunet!ucbvax!aoki
===============================================================================
To add/remove yourself from the POSTGRES mailing list: send mail with
the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"
If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
a human will deal with it. DO NOT post to the "postgres" mailing list.
===============================================================================
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: postgres@postgres.berkeley.edu
Cc: aoki@postgres.Berkeley.EDU, pml@cacs.usl.edu
Subject: Re: PQpnames help
In-Reply-To: <199405092307.QAA29229@faerie.CS.Berkeley.EDU>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox