From 81aabe9cf3836469fecdf22be9bde17451306816 Mon Sep 17 00:00:00 2001 From: "Bruno O. Notario" Date: Thu, 22 Feb 2024 00:21:14 -0300 Subject: [PATCH] Fix MagiQL database interfaces --- system/MagiQL/MagiQL.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/system/MagiQL/MagiQL.php b/system/MagiQL/MagiQL.php index ac5dae6..243e76c 100644 --- a/system/MagiQL/MagiQL.php +++ b/system/MagiQL/MagiQL.php @@ -9,6 +9,7 @@ namespace Phacil\Framework; use Phacil\Framework\MagiQL\Builder; +use Phacil\Framework\Databases\Api\DriverInterface as DatabaseDriverInterface; class MagiQL extends Builder { @@ -33,7 +34,7 @@ class MagiQL extends Builder { */ protected $queryArray; - public function __construct(\Phacil\Framework\Database $db) { + public function __construct(\Phacil\Framework\Api\Database $db) { $this->db = $db; $this->queryObj = new Builder(); @@ -59,26 +60,26 @@ class MagiQL extends Builder { * @throws \Phacil\Framework\Exception */ public function isTableExists($tableName) { - if($this->db->getDBTypeId() == \Phacil\Framework\Interfaces\Databases::LIST_DB_TYPE_ID['MYSQL']){ + if($this->db->getDBTypeId() == DatabaseDriverInterface::LIST_DB_TYPE_ID['MYSQL']){ $sql = 'SELECT (1) AS tbl_exists FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = :v1 AND TABLE_SCHEMA = :v2'; $result = $this->db->execute($sql, [ ':v1' => $tableName, ':v2' => \Phacil\Framework\Config::DB_DATABASE() ]); } - if($this->db->getDBTypeId() == \Phacil\Framework\Interfaces\Databases::LIST_DB_TYPE_ID['MSSQL']){ + if($this->db->getDBTypeId() == DatabaseDriverInterface::LIST_DB_TYPE_ID['MSSQL']){ $sql = "SELECT OBJECT_ID(:v1, 'U') AS table_id"; $result = $this->db->execute($sql, [ ':v1' => $tableName ]); } - if($this->db->getDBTypeId() == \Phacil\Framework\Interfaces\Databases::LIST_DB_TYPE_ID['POSTGRE']){ + if($this->db->getDBTypeId() == DatabaseDriverInterface::LIST_DB_TYPE_ID['POSTGRE']){ $sql = "SELECT 1 FROM information_schema.tables WHERE table_name = :v1"; $result = $this->db->execute($sql, [ ':v1' => $tableName ]); } - if($this->db->getDBTypeId() == \Phacil\Framework\Interfaces\Databases::LIST_DB_TYPE_ID['SQLLITE3']){ + if($this->db->getDBTypeId() == DatabaseDriverInterface::LIST_DB_TYPE_ID['SQLLITE3']){ $sql = "SELECT name FROM sqlite_master WHERE type='table' AND name=:v1"; $result = $this->db->execute($sql, [ ':v1' => $tableName