pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Bax <fbax@sympatico.ca>
To: Adam Haberlach <adam@newsnipple.com>
Cc: pgsql-php@postgresql.org
Subject: Re: passing resource id's through functions
Date: Fri, 11 Jan 2002 14:58:50 -0500
Message-ID: <3.0.6.32.20020111145850.01cb7440@pop6.sympatico.ca> (raw)
In-Reply-To: <20020111103327.A28869@newsnipple.com>
References: <Pine.SOL.3.96.1020111103856.19632A-100000@shell.gis.net>
	<Pine.SOL.3.96.1020111103856.19632A-100000@shell.gis.net>

At 10:33 AM 1/11/02 -0800, Adam Haberlach wrote:
>On Fri, Jan 11, 2002 at 10:44:05AM -0500, Chadwick Rolfs wrote:
>> I seem to have figured out that pg_connect returns a resource ID that will
>> not pass into another function, and that pg_pconnect does.  I'm not too
>> keen on the persistent connections.  Can someone confirm this belief?  I'm
>> trying to remember where on php.net I read how to pass pg_connect
>> resources to other functions, and haven't found it at functions,
>> persistent connections, pg_connect or pg_pconnect.
>
>	Hmm--I've never had any problems with passing the database connection
>handle from pg_connect into pg_exec (the only place you can really use it,
>as far as I know).

The problem is not with passing the connection hanlde to pg_exec exactly.
If you create the connection hanlde in one function, then pass that handle
to another function that actually does the call to pg_exec, then sometimes
there are problems.  In my own case, I figured out if after creating the
connection hanlde, I call two functions that each call pg_exec, then this
normally works, but when a function makes two calls to pg_exec, then the
NEXT function has a problem.

$dbc = pg_connect(); func1($dbc); func2($dbc);
This works fine if func1() and func2() each contain a single call to pg_exec.
If func1() contains two calls to pg_exec(), then func2 fails on call to
pg_exec.

I should also point out, that this was never a problem before I did
upgrades in October.  Unfortunately, I upgraded OpenBSD, pgsql, php(3->4)
and phplib all during the same week.

Frank



view thread (13+ messages)  latest in thread

Message-ID: <3.0.6.32.20020111145850.01cb7440@pop6.sympatico.ca>
Permalink:  ../3.0.6.32.20020111145850.01cb7440@pop6.sympatico.ca/
Also on:    postgresql.org/message-id/3.0.6.32.20020111145850.01cb7440@pop6.sympatico.ca

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: fbax@sympatico.ca, adam@newsnipple.com
  Subject: Re: passing resource id's through functions
  In-Reply-To: <3.0.6.32.20020111145850.01cb7440@pop6.sympatico.ca>
  References: <Pine.SOL.3.96.1020111103856.19632A-100000@shell.gis.net> <3.0.6.32.20020111145850.01cb7440@pop6.sympatico.ca>

* 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