note 70987 added to function.pg-prepare

From: Date: Tue, 07 Nov 2006 12:05:36 +0000
Subject: note 70987 added to function.pg-prepare
Groups: php.notes 
Request: Send a blank email to php-notes+get-119464@lists.php.net to get a copy of this message
If you decide to deallocate (unprepare) a previously prepared sql command it might be better to quote the sql name as in DEALLOCATE "theNameOfMySQL" instead of (the more natural) DEALLOCATE theNameOfMySQL PostgerSQL preserves the case of your identifiers if, and only if, you quote them. The pg_prepare function preserves the case of the sql name you use. A complete example would be $sql = 'SELECT * FROM user WHERE cod_user = $1'; $sqlName = 'selectUserByCode'; if (!pg_prepare ($sqlName, $sql)) { die("Can't prepare '$sql': " . pg_last_error()); } $rs = pg_execute($sqlName, array(1)); do whatever you want with $rs and finally $sql = sprintf( 'DEALLOCATE "%s"', pg_escape_string($sqlName) ); if(!pg_query($sql)) { die("Can't query '$sql': " . pg_last_error()); } ---- Server IP: 66.163.161.117 Probable Submitter: 201.10.168.208 ---- Manual Page -- http://www.php.net/manual/en/function.pg-prepare.php Edit -- https://master.php.net/note/edit/70987 Del: integrated -- https://master.php.net/note/delete/70987/integrated Del: useless -- https://master.php.net/note/delete/70987/useless Del: bad code -- https://master.php.net/note/delete/70987/bad+code Del: spam -- https://master.php.net/note/delete/70987/spam Del: non-english -- https://master.php.net/note/delete/70987/non-english Del: in docs -- https://master.php.net/note/delete/70987/in+docs Del: other reasons-- https://master.php.net/note/delete/70987 Reject -- https://master.php.net/note/reject/70987 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119464) next »