Skip to content

Commit

Permalink
apply code suggestion for oci8
Browse files Browse the repository at this point in the history
  • Loading branch information
michalsn committed Dec 26, 2024
1 parent 11fc75e commit 8e7d17d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion system/Database/OCI8/PreparedQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use BadMethodCallException;
use CodeIgniter\Database\BasePreparedQuery;
use CodeIgniter\Database\Exceptions\DatabaseException;
use OCILob;

/**
* Prepared query for OCI8
Expand Down Expand Up @@ -73,6 +74,8 @@ public function _execute(array $data): bool
throw new BadMethodCallException('You must call prepare before trying to execute a prepared statement.');
}

$binaryData = null;

foreach (array_keys($data) as $key) {
if (is_string($data[$key]) && $this->isBinary($data[$key])) {
$binaryData = oci_new_descriptor($this->db->connID, OCI_D_LOB);
Expand All @@ -85,7 +88,7 @@ public function _execute(array $data): bool

$result = oci_execute($this->statement, $this->db->commitMode);

if (isset($binaryData)) {
if ($binaryData instanceof OCILob) {
$binaryData->free();
}

Expand Down

0 comments on commit 8e7d17d

Please sign in to comment.