Skip to content

Commit

Permalink
esd
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangjincheng committed Jun 12, 2019
1 parent 441e907 commit 321d8fc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/Mysql/Aspect/MysqlAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function aroundTransactional(MethodInvocation $invocation)
* 如果当前没有事务,则抛出异常。
*/
if (!$_transaction_in_progress) {
throw new TransactionException("Propagation::MANDATORY传播模式下当前没有事务");
throw new TransactionException("Propagation::MANDATORY Currently there are no transactions in propagation mode");
}
break;
case Propagation::REQUIRES_NEW:
Expand All @@ -86,14 +86,14 @@ public function aroundTransactional(MethodInvocation $invocation)
*/
$needTransaction = false;
if ($_transaction_in_progress) {
throw new TransactionException("Propagation::NEVER传播模式下当前不能存在事务");
throw new TransactionException("Propagation::NEVER Transactions cannot currently exist in propagation mode");
}
break;
case Propagation::NESTED:
throw new TransactionException("Propagation::NESTED 暂不支持");
throw new TransactionException("Propagation::NESTED Not yet supported");
break;
default:
throw new TransactionException("propagation设置不正确");
throw new TransactionException("propagation Incorrect settings");
}
if ($needNewGo) {
//需要创建一个新的协程来执行mysql
Expand Down Expand Up @@ -154,7 +154,7 @@ private function startTransaction(Transactional $transactional, \MysqliDb $db, M
$this->mysql($transactional->name)->rawQuery("set session transaction isolation level serializable;");
break;
default:
throw new TransactionException("isolation设置不正确");
throw new TransactionException("isolation Incorrect settings");
}
$db->startTransaction();
$result = null;
Expand Down
2 changes: 1 addition & 1 deletion src/Mysql/GetMysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function mysql($name = "default")
/** @var MysqlManyPool $mysqlPool */
$mysqlPool = getDeepContextValueByClassName(MysqlManyPool::class);
$pool = $mysqlPool->getPool($name);
if ($pool == null) throw new MysqlException("没有找到名为{$name}的mysql连接池");
if ($pool == null) throw new MysqlException("No MySQL connection pool named {$name} was found");
return $pool->db();
} else {
return $db;
Expand Down
2 changes: 1 addition & 1 deletion src/Mysql/MysqlManyPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function db(): MysqliDb
{
$default = $this->getPool();
if ($default == null) {
throw new MysqlException("没有设置默认的mysql");
throw new MysqlException("No default MySQL is set");
}
return $default->db();
}
Expand Down
14 changes: 7 additions & 7 deletions src/Mysql/MysqlOneConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,25 +214,25 @@ public function setCharset(string $charset): void
public function buildConfig()
{
if (!extension_loaded('mysqli')) {
throw new MysqlException("缺少mysqli扩展");
throw new MysqlException("Lack of mysqli expansion");
}
if ($this->poolMaxNumber < 1) {
throw new MysqlException("poolMaxNumber必须大于1");
throw new MysqlException("PoolMaxNumber must be greater than 1");
}
if (empty($this->name)) {
throw new MysqlException("name必须设置");
throw new MysqlException("name must be set");
}
if (empty($this->host)) {
throw new MysqlException("host必须设置");
throw new MysqlException("host must be set");
}
if (empty($this->username)) {
throw new MysqlException("username必须设置");
throw new MysqlException("username must be set");
}
if (empty($this->password)) {
throw new MysqlException("password必须设置");
throw new MysqlException("password must be set");
}
if (empty($this->db)) {
throw new MysqlException("db必须设置");
throw new MysqlException("db must be set");
}
return ['host' => $this->host,
'username' => $this->username,
Expand Down

0 comments on commit 321d8fc

Please sign in to comment.