public function executeLob($sql,$lob1, $lob2) {
if ($this->connection) {
// Prepare the statement
$stid = oci_parse($this->connection, $sql);
if (!$stid) {
$e = oci_error($this->connection);
var_dump($e);
}
// Perform the logic of the query
// Creates an "empty" OCI-Lob object to bind to the locator
$myLOB1 = oci_new_descriptor($this->connection, OCI_D_LOB);
$myLOB2 = oci_new_descriptor($this->connection, OCI_D_LOB);
// Bind the returned Oracle LOB locator to the PHP LOB object
$a = oci_bind_by_name($stid, ":mylob_loc_1", $myLOB1, -1, OCI_B_CLOB);
$b = oci_bind_by_name($stid, ":mylob_loc_2", $myLOB2, -1, OCI_B_CLOB);
$r = oci_execute($stid,OCI_NO_AUTO_COMMIT);
if (!$r) {
$e = oci_error($stid);
var_dump($e);
}
// Now save a value to the LOB
if ((!$myLOB1->save($lob1)) || (!$myLOB2->save($lob2))) {
// On error, rollback the transaction
oci_rollback($this->connection);
} else {
// On success, commit the transaction
oci_commit($this->connection);
}
// Free resources
oci_free_statement($stid);
$myLOB1->free();
$myLOB2->free();
return $r;
}
}
|
Comments
Post a Comment