note 99578 modified in function.oci-execute by danbrown

From: Date: Wed, 25 Aug 2010 14:03:24 +0000
Subject: note 99578 modified in function.oci-execute by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172054@lists.php.net to get a copy of this message
Notice (PHP 5.2.12-pl0-gentoo): You can parse empty query, you can execute empty query (returns true), but you cannot fetch data from empty query. So, if you provide query as variable, make sure it isn't empty. <?php $q = oci_parse($c, ""); if($q != false){ // parsing empty query != false if(oci_execute($q){ // executing empty query != false if(oci_fetch_all($q, $data, 0, -1, OCI_FETCHSTATEMENT_BY_ROW) == false){ // but fetching executed empty query results in error (ORA-24338: statement handle not executed) $e = oci_error($q); echo $e['message']; } } else{ $e = oci_error($q); echo $e['message']; } } else{ $e = oci_error($link); echo $e['message']; } ?> --was-- Notice (PHP 5.2.12-pl0-gentoo): <?php $q = oci_parse($c, ""); if($q != false){ // parsing empty query != false if(oci_execute($q){ // executing empty query != false if(oci_fetch_all($q, $data, 0, -1, OCI_FETCHSTATEMENT_BY_ROW) == false){ // but fetching executed empty query results in error (ORA-24338: statement handle not executed) $e = oci_error($q); echo $e['message']; } } else{ $e = oci_error($q); echo $e['message']; } } else{ $e = oci_error($link); echo $e['message']; } ?> You can parse empty query, you can execute empty query (returns true), but you cannot fetch data from empty query. So, if you provide query as variable, make sure it isn't empty. http://php.net/manual/en/function.oci-execute.php

« previous php.notes (#172054) next »