Oh mighty PHP Gods... I have been working on a project for several weeks that comes done to this critical element for completion.
I am inserted a large amount of text into a long_raw datatype column in oracle (dont ask why they used a long_raw data type for this... I have no idea, other then that it has been a huge pain in the.... well you get the picture...
here is what I have found so far. Apparently SQL has a limtation of 4000 charters that can be used in an insert/update statement. I have tried saving the contents of the text into a temp file and loading into the column, I have tried using the blob functions, primarily writing a temporary lob and then saving it. And a number of other techniques.... Here is the code I am currently using that only saves the first 3500 characters.
I have modified the code to remove database info and other functions that I am using...
//CONTENT
$content_html=$_POST['html'];
if (strlen($content_html)>4000) {
$r=0;
while (strlen($content_html)>3500) {
$content[0][$r++]=substr($content_html,0,3500);
$content_html=substr($content_html,3500);
}
} else {
$content[0][0]=$content_html;
}
$Conn = OCILogon('user','pass', 'db') or die ("Bad Login");
//SAVE THE TEXT EMAILS
for ($r=0; $r<sizeof($content[1][$r]); $r++) {
$lob=ocinewdescriptor($Conn, OCI_D_LOB);
if ($r==0) {
$stmt = OCIParse($Conn,"UPDATE table SET long_data=:the_blob WHERE long_id=" . $_POST['table_pk']);
} else {
$stmt = OCIParse($Conn,"UPDATE table SET long_data=lnog_data || :the_blob WHERE lng_id=" . $_POST['table_pk']);
}
OCIBindByName($stmt, ':the_blob', $lob,-1, OCI_B_BLOB);
$lob->WriteTemporary($content[1][$r]);
if (OCIExecute($stmt, OCI_DEFAULT)) {
$status++;
} else {
$error++;
};
ocifreedesc($lob);
ocifreestatement($stmt);
};
The first loop does break the file up accurately. The saving loop doesn't throw errors but doesn't update the column either... (Strange)...
I ahve been looking at this code for weeks... so any help you could provide I would love you forever.... thanks