This commit is contained in:
2021-02-25 17:57:20 +08:00
parent e1fa0a6b12
commit fd001e6fbb
13 changed files with 93 additions and 469 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ declare(strict_types=1);
namespace Database\Mysql;
use Database\SqlBuilder;
use Snowflake\Abstracts\Component;
use Database\Connection;
use Exception;
@@ -276,7 +276,7 @@ class Columns extends Component
private function structure($table): array|static
{
if (!isset($this->columns[$table]) || empty($this->columns[$table])) {
$column = $this->db->createCommand($this->db->getBuild()->getColumn($table))->all();
$column = $this->db->createCommand(SqlBuilder::builder(null)->columns($table))->all();
if (empty($column)) {
throw new Exception("The table " . $table . " not exists.");
}
-30
View File
@@ -5,8 +5,6 @@ namespace Database\Mysql;
use Snowflake\Abstracts\Component;
use Database\Connection;
use Database\Orm\Change;
use Database\Orm\Select;
/**
* Class Schema
@@ -18,37 +16,9 @@ class Schema extends Component
/** @var ?Connection */
public ?Connection $db;
/** @var ?Select */
private ?Select $_builder = null;
/** @var ?Columns $_column*/
private ?Columns $_column = null;
/** @var ?Change */
private ?Change $_change = null;
/**
* @return Select|null
*/
public function getQueryBuilder(): ?Select
{
if ($this->_builder === null) {
$this->_builder = new Select();
}
return $this->_builder;
}
/**
* @return Change
*/
public function getChange(): Change
{
if ($this->_change === null) {
$this->_change = new Change();
}
return $this->_change;
}
/**
* @return Columns|null