Visman 3 rokov pred
rodič
commit
24bbdfe271
1 zmenil súbory, kde vykonal 11 pridanie a 11 odobranie
  1. 11 11
      app/Core/DB.php

+ 11 - 11
app/Core/DB.php

@@ -10,7 +10,7 @@ declare(strict_types=1);
 
 
 namespace ForkBB\Core;
 namespace ForkBB\Core;
 
 
-use ForkBB\Core\DB\Statement;
+use ForkBB\Core\DB\DBStatement;
 use PDO;
 use PDO;
 use PDOStatement;
 use PDOStatement;
 use PDOException;
 use PDOException;
@@ -151,7 +151,7 @@ class DB
         if (\is_file(__DIR__ . "/DB/{$typeU}Statement.php")) {
         if (\is_file(__DIR__ . "/DB/{$typeU}Statement.php")) {
             $this->statementClass = "ForkBB\\Core\\DB\\{$typeU}Statement}";
             $this->statementClass = "ForkBB\\Core\\DB\\{$typeU}Statement}";
         } else {
         } else {
-            $this->statementClass = Statement::class;
+            $this->statementClass = DBStatement::class;
         }
         }
 
 
         if ('sqlite' === $type) {
         if ('sqlite' === $type) {
@@ -181,18 +181,18 @@ class DB
         }
         }
 
 
         $options += [
         $options += [
-            self::ATTR_DEFAULT_FETCH_MODE => self::FETCH_ASSOC,
-            self::ATTR_EMULATE_PREPARES   => false,
-            self::ATTR_STRINGIFY_FETCHES  => false,
-            self::ATTR_ERRMODE            => self::ERRMODE_EXCEPTION,
+            PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
+            PDO::ATTR_EMULATE_PREPARES   => false,
+            PDO::ATTR_STRINGIFY_FETCHES  => false,
+            PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
         ];
         ];
 
 
         return $result;
         return $result;
     }
     }
 
 
-    protected function dbStatement(PDOStatement $stmt): Statement
+    protected function dbStatement(PDOStatement $stmt): DBStatement
     {
     {
-        return new {$this->statementClass}($this, $stmt);
+        return new $this->statementClass($this, $stmt);
     }
     }
 
 
     /**
     /**
@@ -354,7 +354,7 @@ class DB
     /**
     /**
      * Метод расширяет PDO::prepare()
      * Метод расширяет PDO::prepare()
      */
      */
-    public function prepare(string $query, array $params = [], array $options = null): /* : Statement|false */
+    public function prepare(string $query, array $params = [], array $options = null) /* : DBStatement|false */
     {
     {
         $map         = $this->parse($query, $params);
         $map         = $this->parse($query, $params);
         $start       = \microtime(true);
         $start       = \microtime(true);
@@ -376,7 +376,7 @@ class DB
     /**
     /**
      * Метод расширяет PDO::query()
      * Метод расширяет PDO::query()
      */
      */
-    public function query(string $query, /* mixed */ ...$args) /* : Statement|false */
+    public function query(string $query, /* mixed */ ...$args) /* : DBStatement|false */
     {
     {
         if (
         if (
             isset($args[0])
             isset($args[0])
@@ -472,7 +472,7 @@ class DB
         if (isset($this->pdoMethods[$name])) {
         if (isset($this->pdoMethods[$name])) {
             return $this->pdo->$name(...$args);
             return $this->pdo->$name(...$args);
         } elseif (empty($this->dbDrv)) {
         } elseif (empty($this->dbDrv)) {
-            $this->dbDrv = new {$this->dbDrvClass}($this, $this->dbPrefix);
+            $this->dbDrv = new $this->dbDrvClass($this, $this->dbPrefix);
 
 
             // ????? проверка типа
             // ????? проверка типа
         }
         }