note 4149 modified in function.ocinewdescriptor by felipe
| From: | felipe@php.net | Date: | Mon, 26 May 2008 19:38:18 +0000 |
| Subject: | note 4149 modified in function.ocinewdescriptor by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-139806@lists.php.net to get a copy of this message | ||
The code up above is somewhat correct... here's an example of how I got a CLOB to work
<?php
function insert_adinfo($AdInfoID, $MagazineType, $Publish, $DatePost, $BodyText)
{
global $db;
// Insert record into database
$clob = OCINewDescriptor($db, OCI_D_LOB);
$stmt = OCIParse($db,"insert into tblAdInfo values ($AdInfoID,
$MagazineType, '$Publish', to_date('$DatePost', 'YYYY-MM-DD'),
EMPTY_CLOB()) returning BodyText into :the_blob");
OCIBindByName($stmt, ':the_blob', &$clob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
if($clob->save($BodyText)){
OCICommit($db);
}else{
echo "Problems: Couldn't upload Clob\n";
}
OCIFreeDescriptor($clob);
OCIFreeStatement($stmt);
}
?>
--was--
The code up above is somewhat correct... here's an example of how I got a CLOB to
work:<br>
<pre>
function insert_adinfo($AdInfoID, $MagazineType, $Publish, $DatePost, $BodyText)
{
global $db;
// Insert record into database
$clob = OCINewDescriptor($db, OCI_D_LOB);
$stmt = OCIParse($db,"insert into tblAdInfo values ($AdInfoID,
$MagazineType, '$Publish', to_date('$DatePost', 'YYYY-MM-DD'),
EMPTY_CLOB()) returning BodyText into :the_blob");
OCIBindByName($stmt, ':the_blob', &$clob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
if($clob->save($BodyText)){
OCICommit($db);
}else{
echo "Problems: Couldn't upload Clob\n";
}
OCIFreeDescriptor($clob);
OCIFreeStatement($stmt);
}
</pre>
http://php.net/manual/en/function.ocinewdescriptor.php