agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
PQpnames help
2+ messages / 2 participants
[nested] [flat]

* PQpnames help
@ 1994-05-09 14:03  Patrick M. Landry <pml@cacs.usl.edu>
  0 siblings, 1 reply; 2+ messages in thread

From: Patrick M. Landry @ 1994-05-09 14:03 UTC (permalink / raw)
  To: legacy


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
--
patrick

===============================================================================
    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.
===============================================================================




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: PQpnames help
@ 1994-05-09 23:07  Paul M. Aoki <aoki@postgres.Berkeley.EDU>
  parent: Patrick M. Landry <pml@cacs.usl.edu>
  0 siblings, 0 replies; 2+ messages in thread

From: Paul M. Aoki @ 1994-05-09 23:07 UTC (permalink / raw)
  To: Patrick M. Landry <pml@cacs.usl.edu>; +Cc: legacy

"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.
===============================================================================




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1994-05-09 23:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1994-05-09 14:03 PQpnames help Patrick M. Landry <pml@cacs.usl.edu>
1994-05-09 23:07 ` Paul M. Aoki <aoki@postgres.Berkeley.EDU>

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