This commit is contained in:
2023-12-18 18:11:58 +08:00
parent 4bcd4a8a44
commit 9b249e538b
13 changed files with 39 additions and 559 deletions
+2 -17
View File
@@ -14,7 +14,6 @@ namespace Database;
use Database\Affair\BeginTransaction;
use Database\Affair\Commit;
use Database\Affair\Rollback;
use Database\Mysql\Schema;
use Exception;
use Kiri;
use Kiri\Server\Events\OnWorkerExit;
@@ -56,7 +55,6 @@ class Connection extends Component
public bool $enableCache = false;
public string $cacheDriver = 'redis';
public array $attributes = [];
private ?Schema $_schema = null;
/**
@@ -142,19 +140,6 @@ class Connection extends Component
}
/**
* @return mixed
* @throws
*/
public function getSchema(): Schema
{
if ($this->_schema === null) {
$this->_schema = Kiri::createObject(['class' => Schema::class, 'db' => $this]);
}
return $this->_schema;
}
/**
* @return PDO
* @throws
@@ -283,12 +268,12 @@ class Connection extends Component
/**
* @param null $sql
* @param string $sql
* @param array $attributes
* @return Command
* @throws
*/
public function createCommand($sql = null, array $attributes = []): Command
public function createCommand(string $sql, array $attributes = []): Command
{
return (new Command(['connection' => $this, 'sql' => $sql]))->bindValues($attributes);
}