note 96020 added to function.oci-lob-load

From: Date: Wed, 03 Feb 2010 16:09:11 +0000
Subject: note 96020 added to function.oci-lob-load
Groups: php.notes 
Request: Send a blank email to php-notes+get-165627@lists.php.net to get a copy of this message
Reading a OCI-Lob by using the load() function will return only 2k chars, so you miss part of its contents. For example: <?php $sql = "BEGIN :res := getACLOB(id).getclobval(); END;"; $stmt = oci_parse($conn, $sql); $resVal = OCINewDescriptor($conn, OCI_D_LOB); oci_bind_by_name($stmt, ":res", $resVal, -1, OCI_B_CLOB); oci_execute($stmt); $foo = $resVal->load(); // $foo will contain only 2k chars // the following will neither work $foo = $resVal->read( $resVal->size() ); // $foo will contain only 2k chars ?> Use this instead: <?php $sql = "BEGIN :res := getACLOB(id).getclobval(); END;"; $stmt = oci_parse($conn, $sql); $resVal = OCINewDescriptor($conn, OCI_D_LOB); oci_bind_by_name($stmt, ":res", $resVal, -1, OCI_B_CLOB); oci_execute($stmt); $foo = ""; while(!$resVal->eof()){ $foo .= $resVal->read(2000); } // $foo will contain full contents of the CLOB ?> ---- Server IP: 69.147.83.197 Probable Submitter: 80.37.231.215 ---- Manual Page -- http://www.php.net/manual/en/function.oci-lob-load.php Edit -- https://master.php.net/note/edit/96020 Del: integrated -- https://master.php.net/note/delete/96020/integrated Del: useless -- https://master.php.net/note/delete/96020/useless Del: bad code -- https://master.php.net/note/delete/96020/bad+code Del: spam -- https://master.php.net/note/delete/96020/spam Del: non-english -- https://master.php.net/note/delete/96020/non-english Del: in docs -- https://master.php.net/note/delete/96020/in+docs Del: other reasons-- https://master.php.net/note/delete/96020 Reject -- https://master.php.net/note/reject/96020 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#165627) next »