Re: Question regarding the scope of pg_prepare

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

 



On 4/14/06, Will Chapman <willc@xxxxxxxxxx> wrote:
> I have a few different pg_prepare statements in my PHP script.  I was
> wondering what scope they lie in.  Im assuming they are not saved in the
> PSQL database, so it is just for the script?  They are inside of
> functions... does it only last until the function exists?  I just dont
> want to keep on calling it if I don't have to.  Or do I need to call it
> each time the function is called.

They are not stored in the database. They are only used to build the
queries to send to the database.

Reading the example(s) on the php page (http://www.php.net/pg_prepare)
you can use them anywhere, they are in the global scope as long as you
give them different names.

stmtname
The name to give the prepared statement. Must be unique
per-connection. If "" is specified, then an unnamed statement is
created, overwriting any previously defined unnamed statement.

I guess the easiest way is to create a simple script :) Prepare some
statements before and inside a function..

--
Postgresql & php tutorials
http://www.designmagick.com/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux