I have searched high and low and not even found anyone who's had a similar problem. For a server monitoring tool, log files are being pulled from an Oracle database to be displayed in a web interface, but the logs are being displayed truncated in seemingly random places. I've traced the log through the code back to the statement pulling it from the database and it is truncated immediately after that function call. The log is complete in the database.
Each log gets truncated the same way every time, but different logs are being truncated in different places, one after 94 characters, one after 200-ish, others after more than 4000 characters. Every log file is being truncated, regardless of its length. The log has type CLOB in the database and here is the code being used to retreive it:
public function get_log($id) {
$query = "SELECT log from job_log where instance_id = $id";
$output = array();
if ($resource = oci_parse($this->ora_connection, $query) ) {
if (oci_execute($resource, OCI_DEFAULT)) {
while ($result = oci_fetch_array($resource, OCI_ASSOC + OCI_RETURN_NULLS + OCI_RETURN_LOBS)) {
$output[] = array_change_key_case($result, CASE_LOWER);
}
}
}
... return results or empty array ...
}
Outputting the retrieved data immediately after the oci_fetch_array gives me the truncated log. I have also tried using oci_fetch_assoc() and then load() to see if using a reference to the clob would work better, but I still got the log, truncated in the same place as always. Neither have I found any special characters (returns, EOFs, etc) in the log files themselves.
Has anyone else seen this problem before? How did you solve it? Any assistance is greatly appreciated.