改名
This commit is contained in:
@@ -100,17 +100,11 @@ class Connection extends Component
|
|||||||
if (($pdo = Context::getContext($coroutineName)) instanceof PDO) {
|
if (($pdo = Context::getContext($coroutineName)) instanceof PDO) {
|
||||||
return $pdo;
|
return $pdo;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug('mysql connect startTime ' . microtime(true));
|
|
||||||
|
|
||||||
/** @var PDO $connections */
|
/** @var PDO $connections */
|
||||||
$connections = $this->getPool()->get($coroutineName, $this->create($coroutineName, $config));
|
$connections = $this->getPool()->get($coroutineName, $this->create($coroutineName, $config));
|
||||||
if (Context::hasContext('begin_' . $coroutineName)) {
|
if (Context::hasContext('begin_' . $coroutineName)) {
|
||||||
$connections->beginTransaction();
|
$connections->beginTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
debug('mysql connect endTime ' . microtime(true));
|
|
||||||
|
|
||||||
return Context::setContext($coroutineName, $connections);
|
return Context::setContext($coroutineName, $connections);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,6 +120,8 @@ class Connection extends Component
|
|||||||
if (Coroutine::getCid() === -1) {
|
if (Coroutine::getCid() === -1) {
|
||||||
Runtime::enableCoroutine(false);
|
Runtime::enableCoroutine(false);
|
||||||
}
|
}
|
||||||
|
debug('mysql connect startTime ' . microtime(true));
|
||||||
|
|
||||||
$cds = 'mysql:dbname=' . $config['database'] . ';host=' . $config['cds'];
|
$cds = 'mysql:dbname=' . $config['database'] . ';host=' . $config['cds'];
|
||||||
$link = new PDO($cds, $config['username'], $config['password'], [
|
$link = new PDO($cds, $config['username'], $config['password'], [
|
||||||
PDO::ATTR_EMULATE_PREPARES => false,
|
PDO::ATTR_EMULATE_PREPARES => false,
|
||||||
@@ -137,6 +133,8 @@ class Connection extends Component
|
|||||||
$link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$link->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
|
$link->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
|
||||||
$link->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_EMPTY_STRING);
|
$link->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_EMPTY_STRING);
|
||||||
|
|
||||||
|
debug('mysql connect endTime ' . microtime(true));
|
||||||
return $link;
|
return $link;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user