From bcc5e1929b6dc61131e3f72047c292cea7b93b8d Mon Sep 17 00:00:00 2001 From: "Bruno O. Notario" Date: Fri, 22 Mar 2024 21:32:55 -0300 Subject: [PATCH] fix ords --- .../Conectors/Oracle/ORDS/Model/Query.php | 8 ++-- .../database/Databases/Driver/OracleORDS.php | 38 ++----------------- 2 files changed, 7 insertions(+), 39 deletions(-) diff --git a/system/database/Databases/Conectors/Oracle/ORDS/Model/Query.php b/system/database/Databases/Conectors/Oracle/ORDS/Model/Query.php index ab07e98..cb13594 100644 --- a/system/database/Databases/Conectors/Oracle/ORDS/Model/Query.php +++ b/system/database/Databases/Conectors/Oracle/ORDS/Model/Query.php @@ -36,10 +36,6 @@ class Query { $this->handle = $handle; } - private function curlPLQ() { - - } - /** * @param string $sql * @param array $bindParams @@ -107,4 +103,8 @@ class Query { unset($this->handle); $this->handle = \Phacil\Framework\Registry::getInstance()->create(HandleInterface::class); } + + public function getError(){ + return $this->handle->error(); + } } \ No newline at end of file diff --git a/system/database/Databases/Driver/OracleORDS.php b/system/database/Databases/Driver/OracleORDS.php index 1a7070d..8f41377 100644 --- a/system/database/Databases/Driver/OracleORDS.php +++ b/system/database/Databases/Driver/OracleORDS.php @@ -71,39 +71,7 @@ class OracleORDS implements DriverInterface /** {@inheritdoc} */ public function query($sql, $params = array()) { - $this->createStatement(); - $result = false; - try { - $data = $this->statement->prepareSQL($sql, $params); - if ($this->statement && $this->statement->execute($params)) { - $data = array(); - $this->rowCount = $this->statement->rowCount(); - if ($this->rowCount > 0) { - try { - $data = $this->statement->fetchAll(\PDO::FETCH_ASSOC); - } catch (\Exception $ex) { - } - } - // free up resources - $this->statement->closeCursor(); - $this->statement = null; - - /** @var \Phacil\Framework\Databases\Api\Object\ResultInterface */ - $result = \Phacil\Framework\Registry::getInstance()->create(\Phacil\Framework\Databases\Api\Object\ResultInterface::class, [$data]); - $result->setNumRows($this->rowCount); - } - } catch (\PDOException $e) { - throw new \Phacil\Framework\Exception('Error: ' . $e->getMessage() . ' Error Code : ' . $e->getCode() . '
' . $sql); - } - if ($result) { - return $result; - } else { - $result = new \Phacil\Framework\Databases\Object\Result(); - $result->row = array(); - $result->rows = array(); - $result->num_rows = 0; - return $result; - } + return $this->execute($sql, $params); } public function createStatement() { @@ -128,7 +96,7 @@ class OracleORDS implements DriverInterface /** {@inheritdoc} */ public function getLastId() { - return $this->connection->lastInsertId(); + return null; } /** {@inheritdoc} */ @@ -151,7 +119,7 @@ class OracleORDS implements DriverInterface $stmt = $this->statement->prepareSQL($sql, $params)->execute(); if (!$stmt) { - throw new \Phacil\Framework\Exception('Error preparing query: ' . implode(', ', $this->connection->errorInfo())); + throw new \Phacil\Framework\Exception('Error preparing query: ' . implode(', ', $this->statement->getError())); } if ($stmt->getNumRows() && !empty($stmt->getItems())) {