This commit is contained in:
2020-08-31 13:49:40 +08:00
parent 50cc15ea4b
commit 801c7dafc0
5 changed files with 125 additions and 10 deletions
+23
View File
@@ -14,8 +14,10 @@ use Database\Mysql\Schema;
use Database\Orm\Select;
use Exception;
use PDO;
use Snowflake\Config;
use Snowflake\Event;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\ConfigException;
use Snowflake\Snowflake;
/**
@@ -185,6 +187,27 @@ class Connection extends Component
}
/**
* @param $name
* @return Connection
* @throws ConfigException
*/
public function instance($name)
{
$config = Config::get('databases.' . $name, true);
$this->cds = $config['cds'];
$this->username = $config['username'];
$this->password = $config['password'];
$this->tablePrefix = $config['tablePrefix'];
$this->slaveConfig = $config['slaveConfig'];
return $this;
}
/**
* @return PDO
* @throws Exception