public function writeBlob($value)
{
$hash= md5($value);
$handle= 0;
//php_pdo_oci is too slow, It almost takes 5s. It is very fast after switching to php_oci driver.
//IIS 7.5, FastCGI, PHP 5.3.10, ORACLE DATABASE 11g XE, blobs table have only 10,0000 records.
$conn = Database::getConnectionInfo('default');
$conn = oci_connect($conn['default']['username'],$conn['default']['password'],$conn['default']['database']);
$blob = oci_new_descriptor($conn, OCI_D_LOB);
$stmt = oci_parse($conn,"begin identifier.write_blob(:hash,:blobid,:blob); end;");
oci_bind_by_name($stmt, ":hash", $hash, 32, SQLT_CHR);
oci_bind_by_name($stmt, ":blobid", $handle, 32, SQLT_INT);
oci_bind_by_name($stmt, ":blob", $blob, -1, SQLT_BLOB);
$bool = oci_execute($stmt, OCI_DEFAULT);
if($handle) $blob->save($value);
oci_free_statement($stmt);
oci_commit($conn);
oci_close($conn);
/*
$stream= DatabaseConnection_oracle::stringToStream($value);
$stmt= parent::prepare("begin identifier.write_blob(?,?,?); end;");
$stmt->bindParam(1, $hash, PDO::PARAM_STR, 32);
$stmt->bindParam(2, $handle, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT, 32);
$stmt->bindParam(3, $stream, PDO::PARAM_LOB);
$stmt->execute();
*/
$handle= ORACLE_BLOB_PREFIX.$handle;
//syslog(LOG_ERR,"returning handle: ".$handle);
return $handle;
}
Comments
Comment #1
brianV commentedI've put the above change into a patch for review.
Note - I would like to see some definite bookmarks before we consider making this change as it seems... odd... to me.
Comment #2
soraver commentedHi,
i get this error after patching
Comment #3
bohartD7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.
Everyone can apply the patches/suggestions above (not tested by the maintainers, tested by the community) to their D7 projects.
If the issue remains relevant for D10+ versions, merge requests with proposed solutions for a new module version (D10+) are welcome in a new follow-up issue.
Thanks!