Question regarding the scope of pg_prepare
am 14.04.2006 12:58:46 von Will Chapman
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.
Trying to do some proper coding :)
Thanks
Will
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Question regarding the scope of pg_prepare
am 14.04.2006 13:45:51 von Chris Smith
On 4/14/06, Will Chapman 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