For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > April 2006 > Re: [PHP-DB] Question regarding the scope of pg_prepare









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Question regarding the scope of pg_prepare
chris smith

2006-04-14, 7:58 am

On 4/14/06, Will Chapman <willc@monabt.com> 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/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com