Re: passing resource id's through functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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


[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux